求c# 重置 按钮的 代码!!有代码但实现不了。。
private void button10_Click(object sender, EventArgs e){
try
{
foreach (Control control in this.Controls)
{
if (control is TextBox)
{
TextBox txt = control as TextBox;
if (txt != null)
txt.Text = "";
}
if (control is ListBox)
{
ListBox lst = control as ListBox;
if (lst != null)
lst.Items.Clear();
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
运行起来 没有效果啊 不知道 哪的毛病! 我用的是窗体编辑..