Re: How to call base buttons onclick event
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Sat, 30 Jul 2005 21:00:53 +0100
Adam <adam2001usa@xxxxxxxxxxx> wrote:
> This is fine, but it still causes my events to be called twice. In the
> derived form's constructor I tried adding
>
> base.button1.Click -= new System.EventHandler(base.button1_Click);
>
> However, the click event in my derived form still seems to be called
> twice (the message box shows twice).
Thinking about it - try changing the above to:
button1.Click -= new System.EventHandler(button1_Click);
When the event handler is first added, it'll be added with a
polymorphic reference to the derived handler. That's the reference you
need to remove, I suspect!
It would be easier just not to add the second handler though - *just*
override the first one.
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
.
- Follow-Ups:
- Re: How to call base buttons onclick event
- From: Adam
- Re: How to call base buttons onclick event
- From: Adam
- Re: How to call base buttons onclick event
- References:
- How to call base buttons onclick event
- From: Adam
- Re: How to call base buttons onclick event
- From: Jon Skeet [C# MVP]
- Re: How to call base buttons onclick event
- From: Adam
- How to call base buttons onclick event
- Prev by Date: Re: How to call base buttons onclick event
- Next by Date: Re: Form component like common Openfiledialog
- Previous by thread: Re: How to call base buttons onclick event
- Next by thread: Re: How to call base buttons onclick event
- Index(es):