日期:2014-05-19  浏览次数:20442 次

求个技巧问题
一个表单页面,里面有很多的文本框,这个页面有一个取消按钮,当点几这个是,文本框中的内容就清空
txt_first.Text= " ";
txt_last.Text= " ";
txt_pcs.Text= " ";
txt_date.Text= " ";
txt_clno.Text= " ";
txt_actual.Text= " "
后面还有很多..............................有没有什么好的方法不要写这么多,可以用一个什么语句替代????

------解决方案--------------------
foreach (Control c in this.Form.Controls)
{
if (c.GetType() == typeof(TextBox)) (c as TextBox).Text = " ";
}