Can you iterate/loop through all checkbox controls that have been added to a CheckboxGroup? If so, how can this be done? If not, what is the purpose of the CheckboxGroup?
foreach(Control c in this.Controls)
{
if(c is CheckBox)
{
// Do work
}
}
The below code may help-
setLayout(new GridLayout(3, 1));
CheckboxGroup cbg = new CheckboxGroup();
add(new Checkbox("c1", cbg, ...));
add(new Checkbox("c2", cbg, ...));
add(new Checkbox("c3", cbg, ...));
foreach(Control check in this.Controls)
{if(check is CheckBox)
{
//increment i if checkbox
i++; }
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.