RadioButton选中时,触发什么控件 在做一个winform窗体的项目,Form表单上有3个RadioButton,和一个Label,我想做成这样,当选中第一个radiobuttion时,Label.text=first,当选中第二个radiobutton时,Label.text=second。应该怎么做? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 双击第一个radiobuttion:在事件里面写:Label.text=first双击第二个radiobuttion:在事件里面写:Label.text=second if(RadioButton1.Checked) Label.Text = firstelse if(RadioButton2.Checked) Label1.Text = secondelse if(RadioButton3.Checked) Label1.Text = thirdelse ... 将3个RadioButton的CheckedChanged都绑定到下面的radioButton_CheckedChanged事件上。 private void radioButton_CheckedChanged(object sender, EventArgs e) { RadioButton rb = sender as RadioButton; if (rb.Text == "radioButton1") this.label1.Text = "first"; else if (rb.Text == "radioButton2") this.label1.Text = "secord"; else if (rb.Text == "radioButton3") this.label1.Text = "three"; } 同意LS和LSS的 我一般将3个RadioButton的click事件调用同一方法 方法里面同LSS if(RadioButton1.Checked) Label.Text = firstelse if(RadioButton2.Checked) Label1.Text = secondelse if(RadioButton3.Checked) Label1.Text = third private void radioButton1_CheckedChanged(object sender, EventArgs e) { if (radioButton1.Checked) { label1.Text = "first"; } } private void radioButton2_CheckedChanged(object sender, EventArgs e) { if (radioButton2.Checked) { label1.Text = "second"; } } private void radioButton1_CheckedChanged(object sender, EventArgs e) { if (radioButton1.Checked) { label1.Text = "first"; } } private void radioButton2_CheckedChanged(object sender, EventArgs e) { if (radioButton2.Checked) { label1.Text = "second"; } }楼主把3、4楼和我写的结合一下就完美了。 private void radioButton1_CheckedChanged(object sender, EventArgs e) { if (radioButton1.Checked) { label1.Text = "first"; } } WCF小应用(次章,客户端主类) 怎么向数据库中写入一个word文件? c# 中如何让DataGridViewTextBoxColumn的列内容显示*号 C#调用暴风影音 怎样在C#中调用SQL的存储过程? mssql2000中如何存储x的平方这样的数据,如何实现 在vs2005中哪個標籤時用來分框架的 求正则表达式,替换掉HTML代码中的所有HTML标签 一个非常急的问题!!!(在线等待) 如何让checkbox不可以更改,同时框中的颜色不能是灰色的. 一个 C# 引用问题 【急!!】如何统计dataGridView中内容相同的行数,并把统计出的数目放到新建的列中!
在事件里面写:
Label.text=first
双击第二个radiobuttion:
在事件里面写:
Label.text=second
if(RadioButton1.Checked)
Label.Text = first
else if(RadioButton2.Checked)
Label1.Text = second
else if(RadioButton3.Checked)
Label1.Text = third
else
...
{
RadioButton rb = sender as RadioButton;
if (rb.Text == "radioButton1")
this.label1.Text = "first";
else if (rb.Text == "radioButton2")
this.label1.Text = "secord";
else if (rb.Text == "radioButton3")
this.label1.Text = "three"; }
if(RadioButton1.Checked)
Label.Text = first
else if(RadioButton2.Checked)
Label1.Text = second
else if(RadioButton3.Checked)
Label1.Text = third
{
if (radioButton1.Checked)
{
label1.Text = "first";
}
} private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
if (radioButton2.Checked)
{
label1.Text = "second";
}
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
if (radioButton1.Checked)
{
label1.Text = "first";
}
} private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
if (radioButton2.Checked)
{
label1.Text = "second";
}
}
楼主把3、4楼和我写的结合一下就完美了。
{
if (radioButton1.Checked)
{
label1.Text = "first";
}
}