Phil,
Remember that events are defined in terms of Delegates. Delegates have a
GetInvocationList method to get the list of handlers attached to that
delegate, which will be the list of handlers attached to the event.
When you define an event in your class VB.NET will define a delegate field
for that event. You can use this field to get the invocation list.
Public Class Phil
' this creates a NotifyEvent field in the class.
Public Event Notify As EventHandler
Public Sub CheckNotify()
Dim list() As [Delegate] = NotifyEvent.GetInvocationList()
For Each handler As [Delegate] In list
' do something interesting here.
Next
End Sub
End Class
Hope this helps
Jay
"Phil" <pb***@1sourceautowarranty.com> wrote in message
news:1c****************************@phx.gbl...
Does any body know how to get a list of event handlers
assigned to a paticular event?
I'd like to be able to determine if a sub has already been
added as an event handler for a form.paint event.
while eventinfo has methods for addhandler and remove
handler I don't se a way to do a 'gethandler'
or 'enumeratehandlers' etc.
I'm trying to aviod adding a handler more than once.
Thanks