http://ezss.net/fd3250e4.png
I get a parameter count mismatch when trying to invoke.
Printable View
http://ezss.net/fd3250e4.png
I get a parameter count mismatch when trying to invoke.
The problem is that the UpdateDelegate takes a ParamArray of parameters and you can not pass a regular array to a ParamArray and a delegate doesn't allow ParamArrays so it's kind of a catch 22 moment. You can either change your UpdateForm to accept two parameters (a string and an object) or you can pass in a lambda into the UpdateDelegate constuctor and get rid of the delegate.Edit: It should probably look this way just in case an invoke isn't reguired:Code:Public Sub UpdateForm(parameters() As Object)
If Me.InvokeRequired Then
Me.Invoke(Sub()
Select Case CStr(parameters(0))
Case "Title"
Me.Text = CStr(parameters(1))
Case "ButtonText"
Button1.Text = CStr(parameters(1))
Case "Size"
Me.Size = DirectCast(parameters(1), Size)
End Select
End Sub)
End If
End Sub
Code:Public Sub UpdateForm(parameters() As Object)
Dim invokeSub = Sub()
Select Case CStr(parameters(0))
Case "Title"
Me.Text = CStr(parameters(1))
Case "ButtonText"
Button1.Text = CStr(parameters(1))
Case "Size"
Me.Size = DirectCast(parameters(1), Size)
End Select
End Sub
If Me.InvokeRequired Then
Me.Invoke(invokeSub)
Else
invokeSub()
End If
End Sub
@kalo93 - sorry to jump in here - not really on topic - I'm just curious...
Why are you doing an update on a different thread?? What is the requirement that you are serving by doing that??