Canceling Event Processing on a control

  • Thread starter Thread starter JohnR
  • Start date Start date
J

JohnR

I know about AddHandler and RemoveHandler, but my requirement is a little
more complex. I pass a form to a routine. In that routine I must scan each
control, and for each "button" control I find, I must delete it's "click"
event handler. I can't see how to do this using RemoveHandler because I
don't know the name of the delegate handling the event.

So, somehow, having just the control, I need to dynamically see if it's
"click" event is being handled, and by what routine.

Is there a way to find out if a "click" event is being handled for a
control, and then removing that event handler?

BTW I'm still using .Net 1.1 if it makes a difference.

Thanks, John
 
There is a protected readony property Events on forms, that details
all of the attached event delegates.

Because it is protected you may need to add your code to the form instead
of the external routine, and then call the form code from your routine.
 
Hi Blake,

Sorry, but I must be missing something. I set a breakpoint in the form
code and tried to look at "me.events" which got me to a list the quickview
couldn't display, so I tried "me.events.item(0)" and it had a value of
nothing. "me.events" is returning a eventhandlerlist, but that list seems
to be empty.

I tried playing around with it for awhile and couldn't get anything.
Could you be a little more specific on what I need to do?

Thanks, John
 
Back
Top