Calling a sub routine address

rotsey

Newcomer
Joined
Nov 16, 2004
Messages
15
Location
Sydney, Australia
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
 
'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
 
Back
Top