David,
You need to define your parameter as the type of handler you are going to
use, when you call your function/constructor you use addressof, when you
call AddHandler you can use the parameter (as its already has the addressof
something.
Something like:
Public Class Widget
Public Sub New(ByVal theHandler As EventHandler)
Dim ButtonNew As New Button
AddHandler ButtonNew.Click, theHandler
End Sub
End Class
Public Sub Widget_Click(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Dim aWidget As New Widget(AddressOf Widget_Click)
You can find out the type of handler (Delegate) needed by looking up the
event in the online help.
Hope this helps
Jay
"David A. Osborn" <do********@hotmail.com> wrote in message
news:lLkFd.3072$IV5.1712@attbi_s54...
I need to pass the address of a function to the contructor of a class when
I create an instance of it so that in the new instance I can dynamically
hookup a handler by doing the following:
AddHandler ButtonNew.Click, AddressOf My_Passed_Function
I thought I could use a delegate but that doesn't seem to be working. Am I
on the right track?