你好,我是C#的初学者,我有个问题想咨询一下各位高手:
  我的代码是遍历窗体中的控件,如果该件是RadioButton,就将它的checked设置成false(未被选中)。
      foreach (Control item in this.Controls)
                {
                    if (item is RadioButton)
           {
             ————————;
            }
                        
                }
我在横线处填的是((Radiobutton)item).checkde=false;不起作用,请问正确答案应该是什么?

解决方案 »

  1.   

    public void FindControl(Control.ControlCollection  c) 
            { 
                foreach (System.Windows.Forms.Control control in c) 
                { 
                  if (control.HasChildren) 
                  { 
                      FindControl(control.Controls); 
                  } 
                  else 
                  { 
                  if (control is RadioButton) 
                  { 
                    RadioButon rdb= control as RadioButton;
                     rdb.Checked=!rb.Checked
                  
               } 
                } 
            }