472,121 Members | 1,485 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,121 software developers and data experts.

Canceling Event Processing on a control

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
Jul 6 '07 #1
2 1052
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.

"JohnR" <Jo******@hotmail.comwrote in message
news:KPhji.10872$vG2.10126@trnddc02...
>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
Jul 6 '07 #2
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

"Blake" <no@emailwrote in message
news:OR**************@TK2MSFTNGP06.phx.gbl...
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.

"JohnR" <Jo******@hotmail.comwrote in message
news:KPhji.10872$vG2.10126@trnddc02...
>>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

Jul 6 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

18 posts views Thread by Christopher W. Douglas | last post: by
9 posts views Thread by jeff | last post: by
2 posts views Thread by =?Utf-8?B?VG9u?= | last post: by
8 posts views Thread by Brad Walton | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.