在事件中 用for循环找checkbox 控件

解决方案 »

  1.   

    foreach (Control c in Controls)
    {
        if (c is CheckBox) MessageBox.Show(c.Name);
    }
      

  2.   

    我想用for 循环  如果第一个选中   我想判下一个也选中   总之  必须是for循环的!
       谢谢 大神们!
      

  3.   

    CheckBoxList控件
    for(int   i=0;i <CheckBoxList1.Items.Count;i++)
    {
          if(CheckBoxList1.Items[i].Selected==true)
          {
                      //进行相应操作
          }
    }
      

  4.   


     for (int i = 0; i < this.Controls.Count; i++)
      {
          if (Controls[i] is CheckBox)
                    {
     // your code 
                    }               }
      

  5.   

    for(int i=0 ;i<Controls.lenght)
    {if (Controls[i].gettype() == "CheckBox")
    {
    ...
    }
    }
      

  6.   

    Control[] array = Controls.Cast<Control>().ToArray();
    foreach (int i = 0; i < array.GetLength(0); i++)
    {
      if (array[i] is CheckBox) MessageBox.Show(array[i].Name);
    }
      

  7.   

    for(int i=0 ;i<Controls.lenght,i++)