|
-
Jun 12th, 2007, 02:56 PM
#1
Thread Starter
Member
[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
-
Jun 12th, 2007, 06:47 PM
#2
Fanatic Member
Re: Controls on a Windows Form
CheckBox[] checkBoxes = new CheckBox[] {checkBox1, checkBox2, checkBox5};
foreach (CheckBox c in checkBoxes) { . . . }
-
Jun 13th, 2007, 03:06 AM
#3
Thread Starter
Member
Re: Controls on a Windows Form
 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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|