473,320 Members | 2,071 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,320 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 1609
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
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.