我在form的flowLayoutPanel中根据数据表的字段名动态的加入了几个checkbox,请问如何判断哪几个checkbox被选中??

解决方案 »

  1.   

    foreach (CheckBox  c in this.Controls)
                {
                    if(c.Checked)//
                }
      

  2.   


    foreach(Control c in flowLayoutPanel.Controls){
        if(c.GetType() == typeof(CheckBox)){
           CheckBox cb = c as CheckBox;
           MessageBox.Show(cb.Checked.ToString());
        }
    }
      

  3.   

    CheckBox cb = c as CheckBox;
    这个什么意思??