编程遍历页面上所有TextBox控件并给它赋值为string.Empty?
答:foreach(System.Windows.Forms.Control control in this.Controls)
{
if (control is System.Windows.Forms.TextBox)
{
System.Windows.Forms.TextBox tb =(System.Windows.Forms.TextBox)control ;
tb.Text = String.Empty ;
}
}加粗样式
本文介绍了一种方法,用于在Windows Forms应用程序中遍历页面上的所有TextBox控件,并将其文本属性设置为空字符串(String.Empty),以此来清空所有TextBox控件的内容。
1127

被折叠的 条评论
为什么被折叠?



