如题:在winform 程序中,注意不是web程序,winform程序中的radiobutton没有分组那个属性
在groupbox中加了四个radiobuttion,怎样遍历,如:
foreach(groupbox.itemindex)
{
   case 0:
      .....
      break;   case1:
      ...
      break;   ...
}因为现在groupbox没有itemindex这个属性,所以不知道怎么办才好

解决方案 »

  1.   

                
                for (int i = 0; i < groupBox1.Controls.Count; i++)
                {
                    MessageBox.Show(i.ToString());
                    //switch (i)
                    //{
                    //    case 0:
                    //}
                }
      

  2.   

    foreach(Control c in GroupBox1.Controls)
    {
        if(c is RadioButton)
        {
            RadioButton rb = c as RadioButton;
            //do something
        }
    }
      

  3.   

    为什么winform中的控件没有web中的控件好用呢?搞得真是麻烦啊
    哎,不知道VS为什么要取消itemindex这个属性