Is there anyway of getting C# to check, checkboxes while in a loop.. without making them at runtime.. with "new checkboxes()"
imagine a GUI with 8 checkboxes, and 1 button...
checkBox1
checkBox2
checkBox3.. etc..
and a button that does something similar to:
for (int i = 1; i <= 8; i++)
{
checkBox(i).Checked = true;
}
is there anyway to get that too check each checkbox since i can't figure out (or if it's even possible) to get it to use the value of "i" to check the box...
sure i could use a switch to do it.. but i'd like to not make my code messy by doing that. And doing checkBox(i) would be a lot cleaner..
Question
Bi0haZarD
Is there anyway of getting C# to check, checkboxes while in a loop.. without making them at runtime.. with "new checkboxes()"
imagine a GUI with 8 checkboxes, and 1 button...
checkBox1
checkBox2
checkBox3.. etc..
and a button that does something similar to:
is there anyway to get that too check each checkbox since i can't figure out (or if it's even possible) to get it to use the value of "i" to check the box...
sure i could use a switch to do it.. but i'd like to not make my code messy by doing that. And doing checkBox(i) would be a lot cleaner..
Link to comment
https://www.neowin.net/forum/topic/625708-c-checking-checkboxes-in-a-for-loop/Share on other sites
3 answers to this question
Recommended Posts