Click here to Skip to main content
15,910,277 members
Home / Discussions / C#
   

C#

 
GeneralRe: Get The Time When The Program Execute Pin
DucLinh10-May-04 22:09
DucLinh10-May-04 22:09 
GeneralRe: Get The Time When The Program Execute Pin
Heath Stewart11-May-04 3:16
protectorHeath Stewart11-May-04 3:16 
Generalpopup a dialog when change drop down list selection Pin
davidlyy10-May-04 17:29
davidlyy10-May-04 17:29 
GeneralRe: popup a dialog when change drop down list selection Pin
OmegaSupreme11-May-04 0:06
OmegaSupreme11-May-04 0:06 
GeneralRe: popup a dialog when change drop down list selection Pin
Heath Stewart11-May-04 3:51
protectorHeath Stewart11-May-04 3:51 
GeneralRe: popup a dialog when change drop down list selection Pin
davidlyy11-May-04 16:46
davidlyy11-May-04 16:46 
GeneralRe: popup a dialog when change drop down list selection Pin
Heath Stewart12-May-04 2:41
protectorHeath Stewart12-May-04 2:41 
GeneralRe: popup a dialog when change drop down list selection Pin
davidlyy12-May-04 20:09
davidlyy12-May-04 20:09 
GeneralRe: popup a dialog when change drop down list selection Pin
Heath Stewart13-May-04 2:26
protectorHeath Stewart13-May-04 2:26 
Generalsave file dialog box in web application Pin
Marveyles10-May-04 15:48
Marveyles10-May-04 15:48 
GeneralRe: save file dialog box in web application Pin
TigerNinja_10-May-04 18:47
TigerNinja_10-May-04 18:47 
GeneralRe: save file dialog box in web application Pin
Marveyles10-May-04 18:57
Marveyles10-May-04 18:57 
GeneralRe: save file dialog box in web application Pin
Heath Stewart11-May-04 3:23
protectorHeath Stewart11-May-04 3:23 
QuestionVideo Editing Component? Pin
Tony Archer10-May-04 10:36
Tony Archer10-May-04 10:36 
AnswerRe: Video Editing Component? Pin
Roman Rodov10-May-04 14:08
Roman Rodov10-May-04 14:08 
GeneralRe: Video Editing Component? Pin
Tony Archer10-May-04 16:29
Tony Archer10-May-04 16:29 
GeneralRe: Video Editing Component? Pin
osto10-May-04 16:54
osto10-May-04 16:54 
GeneralRe: Video Editing Component? Pin
Kolich11-May-04 1:09
Kolich11-May-04 1:09 
GeneralRe: Video Editing Component? Pin
Tony Archer11-May-04 8:20
Tony Archer11-May-04 8:20 
GeneralRe: Video Editing Component? Pin
leppie11-May-04 7:18
leppie11-May-04 7:18 
GeneralRe: Video Editing Component? Pin
Tony Archer12-May-04 0:31
Tony Archer12-May-04 0:31 
QuestionHow Know if an control has added an event Pin
machocr10-May-04 10:12
machocr10-May-04 10:12 
AnswerRe: How Know if an control has added an event Pin
Heath Stewart10-May-04 10:41
protectorHeath Stewart10-May-04 10:41 
You can either declare your own add and remove accessors for your event (like the get and set accessors for properties), or use a collection or dictionary with events for when objects have been added or removed. If you want to do something like this for a control's events, you should override them like so:
public event Click
{
  add
  {
    if (value.Target is IMyInterface)
      base.Click += value;
  }
  remove { base.Click -= value; }
}
This would allow you to selectively allow event handlers to be added to an event. If you wanted, you could create an event on this subclass that you would fire from these accessors when a delegate (event handler) is added or removed.

If you're just looking for a way to determine if an event handler is added to or removed from and event without going through these steps, I really don't see how that's possible without using some sort of profiler, which is definitely not an easy task.

Although, that does bring up another way, though this really would work for controls. You could use a context-bound object and intercept the event add and remove calls using aspect-oriented programming techniques.

 

Microsoft MVP, Visual C#
My Articles
GeneralSending data over POST Pin
CWIZO10-May-04 9:21
CWIZO10-May-04 9:21 
GeneralRe: Sending data over POST Pin
Heath Stewart10-May-04 9:45
protectorHeath Stewart10-May-04 9:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.