If there have lots of textboxes in the form And wants to clear the content fast, then use the following code. I assumed that all the textboxes inside a groupbox control[i.e., groupBox1].
foreach(Control ctrl in groupBox1.Controls) { if(ctrl is TextBox) { TextBox t = (TextBox)ctrl; t.Text = String.Empty; } }
Note: If the textboxes are on the form directly then replace the "groupBox1.Controls" to "this.Controls".
No comments:
Post a Comment