By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,168 Members | 2,511 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,168 IT Pros & Developers. It's quick & easy.

understanding base.Mouseup event

P: n/a
If a derived class handles MyBase.Mouseup does the base class have to raise
the event?

If both the base and derived class handle it will they both receive it?

If the base overrides OnMouseup and does MyBase.OnMouseUp(mea) does that
effect any of the above answers?

Thanks in advance for any insight passed along


Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
* " Just Me" <ne********@a-znet.com> scripsit:
If a derived class handles MyBase.Mouseup does the base class have to raise
the event?
Yes.
If both the base and derived class handle it will they both receive it?
Yes.
If the base overrides OnMouseup and does MyBase.OnMouseUp(mea) does that
effect any of the above answers?


No. If you don't call 'OnMouseUp' in the base class, the event will not
be raised at all and the handlers are not called.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #2

P: n/a
I'm sorry but the way I asked the questions I'm still confused.

---------------------------
If a derived class handles MyBase.Mouseup does the base class have
to raise the event?


Yes.

So I need to code a MouseUp event in the base class and raise it?
Or does the base class raise it without my help?
--------------------------
If both the base and derived class handle it will they both receive it?


Yes.


Only if the base class raises with my code as described above?

What if I don't code to raise a MouseUp event in the base?
Thanks a lot
Nov 20 '05 #3

P: n/a
* " Just Me" <ne********@a-znet.com> scripsit:
If a derived class handles MyBase.Mouseup does the base class have
to raise the event?


Yes.


So I need to code a MouseUp event in the base class and raise it?


No, if it is already raised by the base class' base class. In other
words: If 'Foo2' inherits from 'Foo1' and 'Foo1' raises the 'Goo'
event, it will be raised for 'Foo2' too.
If both the base and derived class handle it will they both receive it?


Yes.


Only if the base class raises with my code as described above?

What if I don't code to raise a MouseUp event in the base?


If a class' base class raises an event, it will be raised in the class
too, except you override the 'On<event name>' procedure in the derived
class and do not call the base class' 'On<event name>' procedure.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #4

P: n/a
Thanks a lot, again

Think I've got it now!

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ul**************@TK2MSFTNGP09.phx.gbl...
* " Just Me" <ne********@a-znet.com> scripsit:
If a derived class handles MyBase.Mouseup does the base class have
to raise the event?

Yes.


So I need to code a MouseUp event in the base class and raise it?


No, if it is already raised by the base class' base class. In other
words: If 'Foo2' inherits from 'Foo1' and 'Foo1' raises the 'Goo'
event, it will be raised for 'Foo2' too.
If both the base and derived class handle it will they both receive it?
Yes.


Only if the base class raises with my code as described above?

What if I don't code to raise a MouseUp event in the base?


If a class' base class raises an event, it will be raised in the class
too, except you override the 'On<event name>' procedure in the derived
class and do not call the base class' 'On<event name>' procedure.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.