Checking for & storing multiple CheckBox selections in CSharp.
Posted
by Matt
on Stack Overflow
See other posts from Stack Overflow
or by Matt
Published on 2010-05-11T17:50:47Z
Indexed on
2010/05/11
17:54 UTC
Read the original article
Hit count: 443
c#
I'm very new to CSharp and I can't seem to find a good solution to what I would consider a simple problem.
Basically I'm trying to determine which CheckBoxs have been selected by the user and then randomly generate combinations of the selections the user has made. As new as I am, I am aware that you can use a simple statement such as:
checkBox1.IsChecked == true
I could have a long set of if statements which update an array/collection, but I'm told that in Csharp there is a way of determining which CheckBoxs are checked by querying the GroupBox that the CheckBoxs are in. Unless I'm mistaken (which is very possible) this is achieved by using Control features, unfortunately I've not come across these yet in my learning so if someone could clear things up that would be great.
In summation, if someone has a simple solution for running through a set of checkBoxs and storing only the selected ones I would be most grateful.
© Stack Overflow or respective owner