You'll get it better if you create a class and add your own event to it.
The default "e" is a an instance of System.EventArgs
You can derived from that to have your own
e.g.
public class MyEventArgs : System.EventArgs
{
public string EventData {get; private set;}
public MyEventArgs(String argEventData)
{
EventData = argEventData;
}
}
Then to use the above in a class
public class SomeFellaWithAnEvent
{
public event EventHandler<MyEventArgs> OnMyEvent;
private int _value;
public int Value
{
get {return _value;}
set
{
if (_value != value)
{
_value = value;
DoEvent(_value.ToString();
}
}
}
protected void DoEvent(String argData)
{
if (OnMyEvent != null)
{
OnMyEvent(this,new MyEventArgs(argData))
}
}
}
So now you have something where if Value get's changed it will raise an event if you've given it a handler
e.g
SomeFellaWithAnEvent o = new SomeFellaWithAnEvent()
o.OnMyEvent += someThingChanged();
o.Value = 22;
private void somethingChanged(Object sender, MyEventArgs e)
{
// do something with it.
// debug this and you'll see sender is the o instance above, and e is the instance
// of MyEventArgs created in the DoEvent method and has a property set to "22"
}
To add more event handlers to existing controls from the tool box. Click the events tab (lightning button) in the property inspector and then double click in the value.
Or in the code view type label1.Click +=
and then press tab twice.