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

Inherited Form_load event is being called for Inherit as well

P: n/a
Hi All,

I have window based app which has two classes.

Class A and Clas B
Call B Inherits from Class A.
Class A has events. How do I cause Class B not to use Class A events.
For example:
Class A Form_load is being fired even when Class B form is being
loaded. There are other events in Class A( Datagridview events) are
being fired also.

Can I cause some of the events to be fired and some not to be?

TIA,
Alexia

Mar 4 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Mar 4, 9:41 am, alexia....@gmail.com wrote:
Hi All,

I have window based app which has two classes.

Class A and Clas B
Call B Inherits from Class A.
Class A has events. How do I cause Class B not to use Class A events.
For example:
Class A Form_load is being fired even when Class B form is being
loaded. There are other events in Class A( Datagridview events) are
being fired also.

Can I cause some of the events to be fired and some not to be?

TIA,
Alexia
Ok, I've found solution which I am not sure if it is the right one.
I overrided events that I don't wish to use. But, why do I have to
override them if the events are declared as private?
Why are they being fired?

thanks.

Mar 4 '07 #2

P: n/a
private event handlers are always executed whenever and event they handle is
raised. When inheriting from a class that handle some events, and when these
events fired in the child class, event handlers in the parent will be
executed.
--
Muhammad Mosa
Software Engineer & Solution Developer
MCT/MCSD.NET
MCTS: .Net 2.0 Web Applications
MCTS: .Net 2.0 Windows Applications
"al********@gmail.com" wrote:
On Mar 4, 9:41 am, alexia....@gmail.com wrote:
Hi All,

I have window based app which has two classes.

Class A and Clas B
Call B Inherits from Class A.
Class A has events. How do I cause Class B not to use Class A events.
For example:
Class A Form_load is being fired even when Class B form is being
loaded. There are other events in Class A( Datagridview events) are
being fired also.

Can I cause some of the events to be fired and some not to be?

TIA,
Alexia

Ok, I've found solution which I am not sure if it is the right one.
I overrided events that I don't wish to use. But, why do I have to
override them if the events are declared as private?
Why are they being fired?

thanks.

Mar 4 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.