首页上一页 1  下一页尾页 2 条记录 1/1页
         悬赏:2 学分                        
                    		
                            《C#从入门到精通(第4版)》第11章  Windows应用程序常用控件
悬赏:2 学分                        
                    		
                            《C#从入门到精通(第4版)》第11章  Windows应用程序常用控件                                                	
                        
                        
                    
各位大神好,怎么读取所有Groupbox内radiobutton选定的值形成一个数组或者集合。
还请指点,谢谢了!
小禾斗 发表于2018-07-04 09:04
通过遍历控件的Controls集合,判断遍历到的控件是不是单选按钮类型。
老师,遍历时读取不到Radiobutton选定的值,还请老师指点。
private void Form1_Load(object sender, EventArgs e)
        {
            //List<string> list = new List<string>();
            //foreach(var item in this.Controls)
            //{
            //    if(item is RadioButton)
            //    {
            //        RadioButton rb = item as RadioButton;
            //        if (rb.Checked)
            //            list.Add(rb.Text);
            //    }
            //}
            ////label2.Text = list[1];
            //foreach(var i in list)
            //{
            //    label1.Text += i;
            //}