I have a relatively simple question regarding the best way to call the DataGridView.Rows.Add function when it is inherited into the current control. Which is the best way to make the call to the inherited control? Call it directly in the invoke or call it using recursive-like function? They both seem to produce the same result, a row gets added and the quantity is returned, but which is the most efficient?
The delegate: Private Delegate Function ReturnDelegate() As Object
The two ways are:
A)
Private Overloads Function AddRow() As Integer
If InvokeRequired Then
Return CInt(Invoke(New ReturnDelegate(AddressOf AddRow)))
Else
Return Rows.Add()
End If
End Function
Or
B)
Private Function RowsAdd() As Integer
If Me.InvokeRequired Then
Return CInt(Me.Invoke(New ReturnDelegate(AddressOf MyBase.Rows.Add)))
Else
Return MyBase.Rows.Add
End If
End Function