translate vb.NET in C#

F

Franky

have some problem in translate the last row of this class this class:

Public Delegate Sub UIUpdate(ByVal args() As Object)
Public Class Invoker

Private _control As Control
Private _uiUpdate As UIUpdate
Private _args() As Object

Public Sub New(ByVal c As Control)
' store the control that is to run the method on its thread
_control = c
End Sub

Public Sub Invoke(ByVal UIDelegate As UIUpdate, _
ByVal ParamArray args() As Object)
' called by the client and passed the delgate that
' points to the method to run
' as well as the arguments
_args = args
_uiUpdate = UIDelegate
_control.Invoke(New EventHandler(AddressOf _invoke))
End Sub

Private Sub _invoke(ByVal sender As Object, ByVal e As EventArgs)
' this is now running on the same thread as the control
' so freely call the delegate
_uiUpdate.Invoke(_args) ' <== THIS LINE IS MY PROBLEMS
=================
End Sub

End Class


Can someone can help me please?!

Thanks
 
B

Brian W

What's the problem? An error message would be help.

From what I can tell, Invoke takes 2 parameters and you are only passing 1.

HTH
Brian W
 
F

Franky

I run in .Net Compact Framework and the Invoke method take only one
parameter so i want to create my class for pass 2 params.

the error message a got is ((34): Invoke cannot be called directly on a
delegate)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top