-
Events in a usercontrol.
Ok,
I have this code in a usercontrol
PHP Code:
public delegate void commandEntered();
public static event commandEntered doCommand;
but I don't seem to be able to see the event listed in the properties of the control from the form that it is contained on.
Any ideas?
Jeremy
-
whats the difference between a static event and a non-static event?
-
The way you attach to it.
For a normal event you write
Code:
Button button = new Button();
button.Click += new EventHandler(MyHandler);
For a static event you write
Code:
Application.Idle += new EventHandler(MyHandler);
-
In other words it's probably wrong to make events on a user control static.
-
can some one explain me the whole procedure of declaring Event , adding event and raising the event .. in C# i mean some easy sample code , i had a look .Net help but its seemed bit confused as lot of topic included in tht .. i just want to declare and raise an event in my control .. can some one help ...
-
I think this is the way it goes.
PHP Code:
//define the delegate
delegate void myDelegate();
//define your event from your delegate
event myDelegate myEvent
//raise the event
if (myEvent != null)
{
myEvent();
}