473,396 Members | 2,039 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Inherited Form_load event is being called for Inherit as well

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
2 1453
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: tony kulik | last post by:
This code works fine in ie and opera but not at all in Mozilla. Anybody got a clue as to how to get it right? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <script...
10
by: Chad Miller | last post by:
I currently have a base form that I inherit. The base for has a custom event. The event will not raise threw the inherited form. I was wondering if events work threw inheritance or should I use...
6
by: Peter Oliphant | last post by:
I just discovered that the ImageList class can't be inherited. Why? What could go wrong? I can invision a case where someone would like to add, say, an ID field to an ImageList, possible so that...
3
by: Wayne Brantley | last post by:
VS2005 RTM Create a web user control to use as a base class for other web user controls. Now, create a new web user control, change the class it inherits from to your base class and compile....
0
by: Tony Johansson | last post by:
Hello! I have a very specific question and that is about how to inherit a visual control for example the control System.Windows.Forms.TextBox without causing the environment to delete the...
3
by: Matt F. | last post by:
I have an abstract class that about a dozen sub-classes inherit from. I want to enforce that each sub-class shadows an event in the abstract class, but can't quite figure out how to do this. ...
19
by: jan.loucka | last post by:
Hi, We're building a mapping application and inside we're using open source dll called MapServer. This dll uses object model that has quite a few classes. In our app we however need to little bit...
34
by: Smithers | last post by:
I have some logic that populates UI controls with values from App.config. A couple of checkboxes get checked or unchecked; and items loaded into a checked list box. Two reasonable places to put...
5
by: sstory | last post by:
I have a class in vb.net that Inherits Generic.List(Of myclass) I want to have totals in this class that are static...i.e. not recalculated every time. They should be calculated once and never...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.