Inherited Form_load event is being called for Inherit as well

  • Thread starter Thread starter alexia.bee
  • Start date Start date
A

alexia.bee

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