在一个窗体Form中,有文本框Text1和组合框Comb1,如何实现点击取消按钮同时将文本框中的信息和组和框中显示的信息清除掉?
解决方案 »
- C# 读取文本中的字符串
- eWebEditor问他 怎么对他负值
- 将2个datetimepicker中间的日期填充到DataGridView上的问题
- DataGrid中如何在每行最后添加一个LinkButton,如何设置该LinkButton事件,显示该条记录的详细信息?
- 在WinForm中Client的命名空间是什么?
- C#读取XML问题
- ListBox控件的重复行问题
- 欲创一.NET主题之网站,诚邀志同道合之朋友合作
- 再问,关于动态操作另一个系统的问题?谢谢zzhuz(大件), yohomonkey(关在笼子里的猴),TheAres(班门斧)Montaque(Rainman), layerr(new WantT
- 关于msdn的一个疑问?
- serialPort.ReadLine()一执行就死机,Why?
- XML 格式问题
文本框.Text = "";comboBox的ID.SelectedIndex = 0;
comboBox.Text = string.Empty; 或者 comboBox1.SelectedIndex = -1;
//在清除按钮的点击事件中写:
this.Text1.Text="";
this.Comb1.Text="";清除当前文本框中和组合框中的文本
就这么简单!
this.cmbA.clear();
this.Text1.Text.Clear();
this.Comb1.Text = "";
{
foreach (Control c in this.Controls)
{
if (c.GetType() == typeof(TextBox))
{
((TextBox)c).Text=string.Empty;
}
if (c.GetType() == typeof(ComboBox))
{
((ComboBox)c).Text = string.Empty;
}
}
}