3. 请编程遍历页面上所有TextBox控件并给它赋值为string.Empty(简要代码)?

2024-11-18 10:45:13
推荐回答(1个)
回答(1):

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 ;
}
}