How to know a event handler alreay added to invoke list

  • Thread starter Thread starter Ryan Liu
  • Start date Start date
R

Ryan Liu

Hi,

Can someone tell me how to know a event handler alreay added to invoke list?

For example, how can I know
tvwLeft_AfterSelect2 is already added to tvwLeft.AfterSelect so I won't
do it again?

this.tvwLeft.AfterSelect += new TreeViewEventHandler(tvwLeft_AfterSelect);


Thanks!
Ryan
 
Ryan,
For example, how can I know
tvwLeft_AfterSelect2 is already added to tvwLeft.AfterSelect so I won't
do it again?

You can't access the event invocation list from outside the class so
you have to keep that information in a boolean flag or something.


Mattias
 
Well, /generally/ removing something that isn't there doesn't raise an
exception, so you could just remove it first (even if not there), then
add. Or keep track.

Marc
 

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

Similar Threads


Back
Top