* "VJ said:
Is there a known way to check programatically the List of events that are
attached to a control at runtime. Say i need to know if Click event is
attached or not for a button?
Are you referring to the number of handlers attached to an event?
\\\
Public Module Program
Public Sub Main()
Dim c As New FooBar()
AddHandler c.Foo, AddressOf Goo
c.AddSampleHandler()
c.AddSampleHandler()
Console.WriteLine( _
"Anzahl der Handler für Foo: {0}", _
c.NumberOfFooHandlers _
)
RemoveHandler c.Foo, AddressOf Goo
Console.Read()
End Sub
Private Sub Goo()
End Sub
End Module
Public Class FooBar
Public Event Foo()
Public ReadOnly Property NumberOfFooHandlers() As Integer
Get
If FooEvent Is Nothing Then
Return 0
Else
Return FooEvent.GetInvocationList().Length
End If
End Get
End Property
Public Sub AddSampleHandler()
AddHandler Foo, AddressOf Moo
End Sub
Private Sub Moo()
End Sub
End Class
///