I've ended up doing it by creating a static class to house my CustomEvents. It feels like a good solution, as I only need to define the event handler once in the forms I want to use it. It also means I can put all my custom events together. It looks like this:
static class CustEventHandler
{
public delegate void NewCallDataEventHandler();
public static event NewCallDataEventHandler NewCallEvent;
public static void NewCall(int NewCallID)
{
NewCallID = 10;
if (NewCallEvent != null)
{
NewCallEvent();
}
}
}
And CustEventHandler.NewCall(); is ran from the other classes constructor. Obviously I haven't passed any values to the event, but I will. |