正在加载图片...
要确定一组中哪个控件被选中,必须分别测试每个控件,代码示例如 a public void Button1_Click(object sender, System. EventArgs e if ( radiobutton Checked //测试第1个单选按钮是否选中 abell. Text =You selected t Radio Button1. Text else if(Radio Button2 Checked) //测试第2个单选按钮是否选中 Label1Text ="You selected " RadioButton2 Text else if (radiobutton Checked //测试第3个单选按钮是否选中 Labell Text =You selected " Radio 3. Text◼ 要确定一组中哪个控件被选中,必须分别测试每个控件,代码示例如 下: ◼ public void Button1_Click (object sender, System.EventArgs e) ◼ { ◼ if (RadioButton1.Checked) //测试第1个单选按钮是否选中 ◼ { ◼ Label1.Text = "You selected " + RadioButton1.Text; ◼ } ◼ else if (RadioButton2.Checked) //测试第2个单选按钮是否选中 ◼ { ◼ Label1.Text = "You selected " + RadioButton2.Text; ◼ } ◼ else if (RadioButton3.Checked) //测试第3个单选按钮是否选中 ◼ { ◼ Label1.Text = "You selected " + RadioButton3.Text; ◼ } ◼ }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有