473,500 Members | 1,605 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Override Event

Hi,

Is it possible to override an event replacing its EventArgs w/ my own
event? like
this is native event
protected override void OnDropDownClosed(EventArgs e)
{
//code goes here...
}

I created my own EventArgs so I could replace the one on top. Its called
DropDownClosed_EventHandler. So it should look like this.
protected override void OnDropDownClosed(DropDownClosed_EventHandler e)
{
//code goes here...
}
but it doesn't accept it. If i use this code.
public event DropDownClosed_EventHandler DropDownClosed;

DropDownClosed_EventArgs args = new DropDownClosed_EventArgs();
DropDownClosed(this, args);
after i compiled it, it shows 2 DropDownClosed event one is mine and the
other is native. Is there a way to override the original event so i
could use its name at least to create my own event?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
2 4492
Hi Ryan,

Changing the argument list is rather overloading than overriding and I am
not sure overloading is supported for delegates. So I'd just create a second
event with my own EvenArgs type, and I would even name it something like
DropDownClosedEx.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

"Ryan Joseph So" <ac***********@hotmail.com> wrote in message
news:Oj**************@TK2MSFTNGP15.phx.gbl...
Hi,

Is it possible to override an event replacing its EventArgs w/ my own
event? like
this is native event
protected override void OnDropDownClosed(EventArgs e)
{
//code goes here...
}

I created my own EventArgs so I could replace the one on top. Its called
DropDownClosed_EventHandler. So it should look like this.
protected override void OnDropDownClosed(DropDownClosed_EventHandler e)
{
//code goes here...
}
but it doesn't accept it. If i use this code.
public event DropDownClosed_EventHandler DropDownClosed;

DropDownClosed_EventArgs args = new DropDownClosed_EventArgs();
DropDownClosed(this, args);
after i compiled it, it shows 2 DropDownClosed event one is mine and the
other is native. Is there a way to override the original event so i
could use its name at least to create my own event?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 16 '05 #2
Thanks Dmitriy but I still have one question. Is it possible to hide the
native event so only my event would show up when i compiled the project?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #3

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

Similar topics

14
12103
by: JPRoot | last post by:
Hi I use the following syntax to have events inherited from base to child classes which works nicely (virtual and override keyword on events). But I am wondering if it is a "supported" way of using...
8
2874
by: JPRoot | last post by:
Hi M. Jeffrey Tan, Just hopping you didn't forget me? :) Thanks JPRoot ----- \"Jeffrey Tan\" wrote: -----
18
4805
by: bhavin | last post by:
Hi, Can someone point me to some good best practices kind of documentation on use of events compared to method overriding. Ex. In Windows Forms when should i have an event handler for Paint, and...
8
11781
by: Keith Smith | last post by:
Could some one help me a little? I am trying to understand when/where you would ever want to use "protected override..." code such as this. How is this any different from creating a...
0
1087
by: DotNetBBK | last post by:
Hi, I am using a custom text box, where I need to override TabSelection, as I have to generate an event and based on that event, I need to do some processing in other class, who is listening to...
8
5466
by: bdeviled | last post by:
I am deploying to a web environment that uses load balancing and to insure that sessions persist across servers, the environment uses SQL to manage sessions. The machine.config file determines how...
3
1779
by: Publicjoe | last post by:
OK Folks, I am one confused puppy. Can someone please explain what the difference is and when to use each. I have a form with a button dropped onto it. Without actually doing anything to the...
2
1417
by: Publicjoe | last post by:
OK Try again Can someone please explain what the difference is and when to use each. I have a form with a button dropped onto it. Without actually doing anything to the button, I next add the...
4
11956
by: Rob | last post by:
I've constructed a user control inherited from ListView so I can handle and respond to scrolling events (to keep 2 listviews scrolling in sync). My user control includes an Overrides of WndProc...
0
7136
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
7018
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
7232
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...
1
6906
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
5490
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,...
0
4611
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
3106
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1430
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
672
muto222
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.