accessing an Event on a Control

G

Guest

I'd like to access a list of the delegates attached to an Event on a Control.
I know how to get it from a custom event and delegate - using
GetInvocationList() from the Event - but I can't get a handle on the Click
Event, for example. When I try, I get an error saying that Click can only be
used to the left of += or -=.

Please help!
 
T

Tim Haughton

An event is syntactic sugar. It creates a private delegate instance that
does the calling. You can get the invocation list from the event only from
*within* the class declaring the event. From outside the class, I'm afraid
you're stuck. Unless of course you own the control in which case you could
expose the invocation list on the control through a method.

--
Regards,

Tim Haughton

Agitek
http://agitek.co.uk
http://blogitek.com/timhaughton
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top