473,388 Members | 1,177 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,388 software developers and data experts.

How to determine if event has been delegated?

I'm writing a framework component, and I would like to be able to
determine if a particular event has been delegated or not.
By event delegation, I mean:
control.event += handler (method);

I want to know if the event has already been delegated or not. Even
though events use the "+=" syntax, they're not true indexers, so they
don't have a Count.

Any ideas?
TIA,
Vince
Jul 21 '05 #1
2 1615
How about something like "control.event == null" when no delegates have been
bound. This is what the OnXXX methods do to determine if they should raise
the event.
"Vince" <vf****@covansys.com> wrote in message
news:eF**************@TK2MSFTNGP14.phx.gbl...
I'm writing a framework component, and I would like to be able to
determine if a particular event has been delegated or not.
By event delegation, I mean:
control.event += handler (method);

I want to know if the event has already been delegated or not. Even
though events use the "+=" syntax, they're not true indexers, so they
don't have a Count.

Any ideas?
TIA,
Vince

Jul 21 '05 #2
Vince.... event.GetInvocationList() may work.

Delegate[] handlers= callhome.GetInvocationList();
foreach (Delegate d in handlers)
{
d.DynamicInvoke(new object[]{this,
*** new
ThreadedProcessEventArgs(this.ConsoleOutput,this.C onsoleError,this.ExitC
od
e)});
}

Regards,
Jeff
I want to know if the event has already been delegated or not

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

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

Similar topics

3
by: John Taylor | last post by:
How do I invalidate the click event of a sub classed button from the parent class. I've created a button usercontrol for my windows form, and in the click event in the parent if got a...
18
by: Christopher W. Douglas | last post by:
I am writing a VB.NET application in Visual Studio 2003. I have written a method that handles several events, such as closing a form and changing the visible status of a form. I have some code...
4
by: Bob Rock | last post by:
Hello, is there a way to dynamically query if a callback delegate has been tied to an event to avoid raising the event if none have been tied or raise an exception if proper for the situation???...
3
by: George K | last post by:
Hi, i have a very irriting problem that i have written a short piece of code to demonstrate. The problem is that my aspx page is not fully refreshed after an event, which is delegated to an...
1
by: Thomasa Gregg | last post by:
I need to be able to determine if an image has focus after a onmouseout function has been ran from another image. any ideas? Thanks
2
by: Vince | last post by:
I'm writing a framework component, and I would like to be able to determine if a particular event has been delegated or not. By event delegation, I mean: control.event += handler (method); I...
14
by: Brett Romero | last post by:
I'm using a DataGrid and have assigned this.DataSourceChanged += new EventHandler( DataGrid_DataSourceChanged ); This works fine but there is one case where it doesn't. How can I check if...
2
by: Gary Brown | last post by:
Hi, I need to either determine that a child form has been closed or disable the close box without removing the entire control box. Is there an easy way to determine if a child form has been...
6
by: Bob Johnson | last post by:
How can I programmatically determine when a MDI child form has been dragged from one location to another within its MDI parent form? Ideally I'd like to trap some event that occurs when the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.