我如何使用单选按钮,C#.NET [英] how can i work with radiobuttons,C#.NET
本文介绍了我如何使用单选按钮,C#.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的.
我的表单中有2个单选按钮和1个文本框.
我想如果用户选择第一个单选按钮,则文本框可用,如果用户选择第二个单选按钮,则文本框不可用.
Hi dears.
I have 2 radiobutton & one textbox in my form.
I want if user select first radio button the textbox be available and if user select second radio button the textbox be notavailable.
推荐答案
hi,
检查一下.
http://asp-net-example.blogspot. in/2009/03/how-to-use-oncheckedchanged-event-in.html [
check this..
http://asp-net-example.blogspot.in/2009/03/how-to-use-oncheckedchanged-event-in.html[^]
understand the usage and do it accordingly.
嗨.
检查此代码:
Hi .
check tis code:
if (RadioGender.SelectedValue=="RadioButtonName")
{
textbox1.Enabled = true;
}
else
{
TextBox2.Enabled = true;
}
==如果有帮助,请投票==
==if it is helpful please vote==
此代码可能会为您提供适当的帮助
This code may be help you properly
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
if (radioButton1.Checked == true)
{
textBox1.Enabled = true;
}
else
{
textBox1.Enabled = false;
}
/********or********/
textBox1.Enabled = radioButton1.Checked;
///////////////////
}
高兴地编码.
Be Coding with joy.
这篇关于我如何使用单选按钮,C#.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文