[RESOLVED] Controls on a Windows Form
I have a form with quite a few controls on : labels, text boxes, masked text boxes, check boxes etc.
I want to be able to write something that checks the values of certain check boxes, if this are checked then go off and do something else.
I initially started by checking each one in turn, but I don't think that this is the best way forward.
I almost want something like:
foreach CheckBox check in this.Controls - but need to limit to check boxes only.
Can anyone help?
Many thanks
Mark
Re: Controls on a Windows Form
CheckBox[] checkBoxes = new CheckBox[] {checkBox1, checkBox2, checkBox5};
foreach (CheckBox c in checkBoxes) { . . . }
Re: Controls on a Windows Form
Quote:
Originally Posted by nebulom
CheckBox[] checkBoxes = new CheckBox[] {checkBox1, checkBox2, checkBox5};
foreach (CheckBox c in checkBoxes) { . . . }
I didn't think of using an array. Will limit the number of passes too.. :)
Cool, thank you