foreach (Control c in myGroupBox.Controls) { CheckBox cb = c as CheckBox; if ((cb != null) && cb.Checked) { // Do whatever you want here } }
// required using Linq; // in some method or EventHandler: List<checkbox> cbList = someGroupBox.Controls.OfType<checkbox>().ToList(); foreach(CheckBox cb in cbList) { // do something with the CheckBox if(cb.Checked) { // it's checked } else { // it's not checked } }</checkbox></checkbox>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)