I will tell my requirement. I need to have a keydown event for each control in the Windows Forms form. It\'s better to do so rather than manually doing it for all c
keydown
A simple recursive function should do it.
private void AddEvent(Control parentCtrl) { foreach (Control c in parentCtrl.Controls) { c.KeyDown += new KeyEventHandler(c_KeyDown); AddEvent(c); } }