C
Charles Law
Sorry, but I am on a bit of a roll today.
I have just found that I can make a method private to my class, but then use
AddHandler in an external class to hook it up. Is that what people would
expect?
For example
<code>
Public Interface IMyClass
Sub MyMethod(ByVal sender As Object, e As EventArgs)
End Interface
Public Class MyClass
Implements IMyClass
' NOTE: this is declared Private
Private Sub MyMethod(ByVal sender As Object, e As EventArgs) Implements
IMyClass.MyMethod
' Do stuff
End Sub
End Class
Public Class MainClass
Public Event MyEvent(ByVal sender As Object, e As EventArgs)
Public Sub SetHandler()
Dim imc as IMyClass
imc = New MyClass
'*** This works. Should it? ***
AddHandler MyEvent, AddressOf imc.MyMethod
End Sub
End Class
</code>
Charles
I have just found that I can make a method private to my class, but then use
AddHandler in an external class to hook it up. Is that what people would
expect?
For example
<code>
Public Interface IMyClass
Sub MyMethod(ByVal sender As Object, e As EventArgs)
End Interface
Public Class MyClass
Implements IMyClass
' NOTE: this is declared Private
Private Sub MyMethod(ByVal sender As Object, e As EventArgs) Implements
IMyClass.MyMethod
' Do stuff
End Sub
End Class
Public Class MainClass
Public Event MyEvent(ByVal sender As Object, e As EventArgs)
Public Sub SetHandler()
Dim imc as IMyClass
imc = New MyClass
'*** This works. Should it? ***
AddHandler MyEvent, AddressOf imc.MyMethod
End Sub
End Class
</code>
Charles