473,785 Members | 3,349 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1463
On Mar 4, 9:41 am, alexia....@gmai l.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********@gma il.com" wrote:
On Mar 4, 9:41 am, alexia....@gmai l.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
3606
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 language="JavaScript" type="text/javascript"> function show(that) { if (box.style.visibility=='hidden') { that.style.visibility = 'visible'}; }
10
2146
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 some other method? -- Chad Miller President and Director of Software Development Predictive Concepts, Inc. www.predictiveconcepts.com 407.327.9910
6
1771
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 the individual elements in an array of ImageList's could be identified by the ID, thereby allowing re-ordering the array without harm. A person could identify by index into the array, but that would not be preserved by re-ordering (and re-ordering...
3
5483
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. (You must have a <% Register %> so it will see it) You will get TWO warnings per class like:
0
1594
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 control when there are some compile errors. It's the same problem with any visual control that you inherit. The control is deleted as soon as you use the View Designer when there is compile error. It's very easy to reproduce my problem. You can do...
3
2014
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. Basically, all of the inherited classes deal with data in some way or another. I need to make sure that when the data is changed on any of those classes, they raise an event called "DataChanged", and have that enforced in some way from the abstract...
19
2236
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 modify come of the classes so they match our purpose better - mostly add a few methods etc. Example: Open source lib has classes Map and Layer defined. The relationship between them is one to many. We created our own versions (inherited) of Map...
34
3459
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 this code: 1. the form's constructor (or in a method called from within the constructor) 2. the Form_Load event procedure What are the important considerations or tradeoffs entailed by those two
5
1495
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 again unless the collection is modified, or the data in one of the objects in the collection is changed. How can I do this? Thanks,
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10087
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7496
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.