469,645 Members | 1,941 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,645 developers. It's quick & easy.

remove inherited event handler

Tee
Hi,

Anyone know how to remove a event handler that inherited from another form?

I have a base form, and there is a button with click event in the base form.
1 of my another form inherits this base form, and so the button is shown
with the click event, I want to remove that event without altering the base
form, is this possible?
Thanks,
Tee
Nov 16 '05 #1
1 2493
Do you have access to the function used to create the delegate? If so you can
create a delegate over that function, and then remove it from the event. You'd
have to do this after your InitializeComponent() method in the constructor of
your derived form.

this.Click -= new EventHandler(base.Form_Click);

Since you can't get at the delegate to call the methods you might use to clear
it, you are stuck there for the most part.
--
Justin Rogers
DigiTec Web Consultants, LLC.
Blog: http://weblogs.asp.net/justin_rogers

"Tee" <th*@streamyx.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi,

Anyone know how to remove a event handler that inherited from another form?

I have a base form, and there is a button with click event in the base form.
1 of my another form inherits this base form, and so the button is shown
with the click event, I want to remove that event without altering the base
form, is this possible?
Thanks,
Tee

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by joe | last post: by
3 posts views Thread by Peter Oliphant | last post: by
10 posts views Thread by Chad Miller | last post: by
10 posts views Thread by Franky | last post: by
4 posts views Thread by asad.naeem | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.