remove inherited event handler

  • Thread starter Thread starter Tee
  • Start date Start date
T

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
 
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.
 
Back
Top