Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

I want to pass to a sub in a web page class the address of a sub in that class like this

 

MySub(addressof MyOtherSub)

 

But how do I write the declaration of MySub

 

As in something like

 

public sub MySub(sub as Somethingorother)

 

what is the "Somethingorother" to be??????

 

Please help

rotsey

Posted

'Create a Delegate, that has the same params as your function

Delegate Sub Pixel(ByVal x As Integer, _

ByVal y As Integer)

 

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

MessageSystem(AddressOf PlotPixel)

End Sub

 

Private Sub MessageSystem(ByRef proc As Print)

proc.DynamicInvoke(New Object() {1, 2})

End Sub

 

Private Sub PlotPixel(ByVal x As Integer, ByVal y As Integer)

MessageBox.Show(x.ToString())

End Sub

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...