Wiring events...need advice
I have a form with lots of checkboxes on it.
I want to loop through and wire all the checkboxes "checkedchanged" events to a custom method.
Can I loop through InitializeComponent() and wire it up? If so, can someone post some code?
Here is what i was thinking and hope to do. Please offer any advice or better way to do this.
foreach (object obj in this.Controls)
{
if (typeof(obj) == System.Windows.Forms.CheckBox)
{
obj.click += new System.EventHandler(<custom method>)
}
}
Thanks