用C#编写,窗体中有一个textbox与9个radiobutton,radiobutton都放在一个groupbox里面,要求当textbox中输入0到9的数字后对应的选中到0到9的radiobutton。然后安回车,弹出相应radibutton的事件。有例子的最好,能发代码的也可以,谢谢了。
解决方案 »
- LINQ to SQL 中的DataContext方法及记录的存储
- asp.net中Windows身份验证怎么设置能让它不出现用户名登录的那个框框。
- c#.net如何提取当前日期中号数?
- DbConnection与Connection的区别?
- Process.start("cmd.exe")的问题
- C#的dataGridView如何限制输入的字符和输入长度
- .net空间的疑问
- 关于System.Collections.DictionaryBase
- 关于自定义数据类型,大家看看。来人有分。
- 如何判定问题 如何 判定 textbox失去焦点 ,C# web程序
- 请问 gridview 在哪里找?
- C#中的 Graphics.DrawImage可不可以绘制动态图片?
循环赋值给radiobutton
自己想的 没试过!
{
if (e.KeyValue >= 49 && e.KeyValue <= 53)
{
int i = Convert.ToInt32(((char)e.KeyValue).ToString());
RadioButton db = ls[i - 1] as RadioButton;
db.Checked = true;
//radioButton1_Click(ls[i-1],null);
}
}
List<RadioButton> ls = new List<RadioButton>();
private void radioButton1_Click(object sender, EventArgs e)
{
MessageBox.Show("Hi");
} private void Form5_Load(object sender, EventArgs e)
{
foreach (Control c in this.groupBox1.Controls)
{
if (c is RadioButton)
{
ls.Add(c as RadioButton);
}
}
}
你要把所有RadioButton的Click事件都指向radioButton1_Click
textBox1.Text的值就行,可以用switch语句判断0-9的字符串,给相应的单选钮的Checked = true
就会自己弹出他的事件来了