I am sorry if this has been covered before. I have got events defined like this
event MouseEventHandler MouseDown; event EventHandler TimerTicked; event KeyEventHander KeyPress; delegate void MouseEventHandler(object sender, MouseEventArgs e); delegate void KeyEventHandler(object sender, KeyEventArgs e); delegate void EventHandler(object sender, EventArgs e); Now MouseEventArgs and KeyEventArgs are both derived from EventArgs For each of the events I want to take the same action. So I define a generic function void OnAllEvents(object sender, EventArgs e) { Application.Exit(); } It would be possible to pass a MouseEventArgs object as the second parameter of the function. E.g MouseEventArgs e = new MouseEventargs(...); OnAllEvents(this, e); But unfortunately I can't do this object.MouseDown += new EventHandler(this.OnAllEvents); None of the syntax I have tried works. The only thing I have to do is to write three separate functions. Is there no better way? You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.