473,480 Members | 2,014 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Overriding events...

I've got some descendent classes and I would like to be able to stop the
base class event from firing... How do I do that?
Nov 16 '05 #1
2 1797
Hello!

You could to two things:

1. Override the method firing the event if it's marked as virtual
2. Declare a function with the same name and signature as "new", effectively
hiding the method in the base class.

--
venlig hilsen / with regards
anders borum
--
Nov 16 '05 #2
Not quite sure exactly what you mean by base class event firing, but
virtually all standard events have virtual handlers in the base class. If
you override that handler and do not explicitly invoke it in your derived
class you accomplish what I think you want to accomplish.

For example, override OnPaint() in a form rather than implementing an
explicit event handler. The same technique can be used for your own events
and classes.

Thomas P. Skinner [MVP]

"Jack Addington" <ja********@shaw.ca> wrote in message
news:uC*************@TK2MSFTNGP10.phx.gbl...
I've got some descendent classes and I would like to be able to stop the
base class event from firing... How do I do that?

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4148
by: Ali Eghtebas | last post by:
Hi, I have 3 questions regarding the code below: 1) Why can't I trap the KEYDOWN while I can trap KEYUP? 2) Is it correct that I use Return True within the IF-Statement? (I've already read...
8
2228
by: Edward Diener | last post by:
Is it possible for a derived class to override a property and/or event of its base class ?
1
1629
by: Robert | last post by:
Hi, I've inherited the XmlDocument class to include some custom methods that I want to use on a particular XML file. I need to know whether the document has changed since being loaded, and I...
6
2655
by: Mike | last post by:
Hi, I have such problem: On my form I have TabControl. I want to move from one tab to another using "Next" and "Prev" button. This part works fine. But control also supports switching between...
4
5932
by: Phill. W | last post by:
Here's a knotty little problem. I have some nasty little controls that needs to behave in a non- windows-Standard way - don't ask why; it's a large application being converted from some older...
1
2041
by: H.B. | last post by:
Hi, By default, ListView handles Up & Down arrow keys events to change the current item selected. I need to disable this feature because I do custom processing on these events. How can I do...
1
2230
by: Sin Jeong-hun | last post by:
When you create a new C# project, Visual Studio creates a main form for you. If you double click it, the Visual Studio automatically adds an event handler for the form's Load event. Then you can...
0
7055
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,...
0
7060
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,...
1
6760
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
7022
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
5365
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,...
1
4799
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...
0
4501
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...
0
3013
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...
1
572
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.