如何正确获取在groupbox中放置了多个radiobutton控件的值?
解决方案 »
- c#如何实现IIS伪静态
- 锁定窗体在panel容器里
- 百分求助:莫名httpwebrequest超时问题,已经有好几个人问了同样问题,但没见到解决方法
- 武汉的朋友请进!
- 100分求 将dataset更新到数据库中,不使用adapter~
- 通过ADO.NET连接SQL数据库的方法!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- 救命~~我想了一个星期多啦..还不知道为什么??????//
- 开始学C#.net 装上了六张盘后,开始学习,可是.........
- windows2003的bug
- datagrid如何提交用户最后的输入?
- 如何获得没有关闭的线程数量?
- 求助!c#通过模板生成Word报告出错:被呼叫方拒绝接受呼叫
If ctl.GetType Is RadioButton1.GetType() Then
If CType(ctl, RadioButton).Checked Then
MsgBox(ctl.Name)
Exit For
End If
End If
Next
{
RadioButton rb = con as RadioButton;
if (rb.Checked)
{
//获取RadioButton的Text
this.label1.Text = rb.Text;
} }
http://topic.csdn.net/u/20080604/18/13998d15-cbc0-496e-8437-860441460863.html
[/Quote不是那个啊 我举例来说吧 在groupbox中有2个radiobutton控件 分别是 男 和 女
现在使用一个srting类型的变量来存储groupbox中所获得的radiobutton选择 即是男还是女
foreach (Control con in this.groupBox1.Controls)
{
RadioButton rb = con as RadioButton;
if (rb.Checked)
{
getstr = rb.Text;
}
}
getstr 是string变量 但是使用messagebox.show(getstr)所显示的根本没有内容啊 并且在选择了radiobutton以后 getstr的值还是null啊