C# visual inheritance...

  • Thread starter Thread starter Gordon Smith
  • Start date Start date
G

Gordon Smith

Hi,

I'm trying to create a form in c# that I visually inherit
from.
It includes a button, that when I click, displays a "hello
world" message.
I then create an inherited form, and create an event
handler for the button that displays a "hello world 2"
message.
The problem is, that when I run the program, and click the
button, I see both messages (i.e. both event handlers are
called).
Is there any way to suppress the original event handler
call?

Thanks

Gordon.
 
It would seem that the event handler should not be part of the ancestor form
unless you want to use it in the child classes. Both should be assigned
dynamically. I suppose you could remove it using the -= operator or null
OnClick property before assigning the new handler, but I can't imagine why
you would do that.

Robert Zurer
 
Back
Top