bool[] states =new boo[checkbox的数量]; int i=0;foreach(Control c in this.groupBox1) { if(c.GetType()==typeof(CheckBox)) { states[i]=c.Checked; i++; } }
foreach(Control c in this.groupBox1.Controls) 好像是这样的吧
bool[] states =new boo[checkbox的数量]; int i=0; foreach(Control c in this.groupBox1) { if(c is CheckBox) { states[i]=c.Checked; i++; } }
List<string> list=new ArrayList<string>foreach(Control c in this.groupBox1.Controls) { if(c is CheckBox) { if(((CheckBox)c).Checked) list.add(c.Text); } }
int i=0;foreach(Control c in this.groupBox1)
{
if(c.GetType()==typeof(CheckBox))
{
states[i]=c.Checked;
i++;
}
}
int i=0; foreach(Control c in this.groupBox1)
{
if(c is CheckBox)
{
states[i]=c.Checked;
i++;
}
}
{
if(c is CheckBox)
{
if(((CheckBox)c).Checked)
list.add(c.Text);
}
}