If your event handler for panel.MouseEnter is called panel_MouseEnter , use this code:
private void FixPanelMouseEnter(Panel panel) { foreach (Control ctrl in panel.Controls) ctrl.MouseEnter += panel_MouseEnter; }
Note that the event handler must be a method, not an event.
This method (which may be an anonymous method) must match the EventHandler signature of the subscriber - void EventHandler(Object sender, EventArgs e) .
Update:
Now I see what you are trying to achieve.
Here is one way to make your code work:
private void FixPanelMouseEnter(Panel panel, EventHandler commonHandlerForPanel) { foreach (Control ctrl in panel.Controls) ctrl.MouseEnter += commonHandlerForPanel; }
Odded source share