就是想把  选中的radiobutton控件的text显示在lable中 下面是我的代码        string str = "asd";
        foreach (Control c in this.Controls)
        {
   
            if (c is RadioButton)
            {
                if (((RadioButton)c).Checked == true)
                {
                    str = ((RadioButton)c).Text;
                }
            }
        }
        Label3.Text = str;
这个是在web    asp.net中编写的 ……web  和  winform  编程的大概区别是什么??

解决方案 »

  1.   

    最大的区别?呵呵?你做上一段时间的web和winform大概就知道了。
      

  2.   

    Web Form应用程序部署在服务器端,用户通过浏览器与其交互;
    Win Form应用程序需要部署到客户端,用户通过专门为该程序打造的用户界面与其交互。
      

  3.   

      那我上面的代码应该如何修改呢?? 在lable中 显示选中radiobutton的text
      

  4.   

    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) 
                  { 
                    RadioButton rdb= control as RadioButton; 
                  } 
                  } 
                } 
            }
      

  5.   

            string str = "asd";
            foreach (Control c in this.form1.Controls)
            {
       
                if (c is RadioButton)
                {
                    if (((RadioButton)c).Checked == true)
                    {
                        str = ((RadioButton)c).Text;
                    }
                }
            }
            Label3.Text = str;在foreach的条件中  有form1