C#怎么判断radioButton为选中状态?

awnuytnh 2009-09-28 02:47:17
怎么判断radioButton为选中状态,比如有三个radioButton,我当第二个被选中时显示出一个textbox,当然之前这个texwbox的Visible是false的,应该怎么写呢?
...全文
13696 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
liushaofeng89 2012-06-30
  • 打赏
  • 举报
回复
首先,你可以为所有的RadioButton添加一个单击事件,事件添加以后,编写代码如下:(之前有一个文本框textBox1用来接收被选中RadioButton的文本)
RadioButton rdb = (RadioButton)sender;
this.textBox1.Text = rdb.Text;
liujintaozyc 2009-09-28
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 xuenzhen123 的回复:]
判断radioButton的selected属性
true的话是选中
false是未选中
[/Quote]
顶 就是个if语句
自己写写试试
angel6709 2009-09-28
  • 打赏
  • 举报
回复
lljfl 2009-09-28
  • 打赏
  • 举报
回复
radiobutton.checked


private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
if(radioButton2.Checked)
Textbox.Visible=true;
}
xuenzhen123 2009-09-28
  • 打赏
  • 举报
回复
判断radioButton的selected属性
true的话是选中
false是未选中

111,113

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧