Events raising exception if no one hooked into.

  • Thread starter Thread starter Rajesh.V
  • Start date Start date
R

Rajesh.V

I have made a custom control in asp.net using webcontrols, and am raising my
event. I find that if no control is hooked into the event it goes for a
toss. I tried to find length of the delegate array returned by

ButtonClicked.GetInvocationList method

event that is raising an exception. Presently i am enclosing in try catch
block and would like to avoid that. Any suggestions on how to find if any
body is hooked/listening to this event.

Rajesh
 
Thankx thats just what i need, it works.......

José Joye said:
I'm not sure I fully understood your problem. However, before firing an
event, your should check if it is not null.

if (GotSomething != null)
GotSomething("Just a try...");

José


raising
 
Back
Top