You can clear all textbox controls of the windows form with the help of this code snippet:
[vb]
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ClearAllTextBox() End Sub Private Sub ClearAllTextBox() Dim _ctrl As Control Dim _txt As TextBox For Each _ctrl In Me.Controls If (_ctrl.GetType() Is GetType(TextBox)) Then _txt = CType(_ctrl, TextBox) _txt.Text = "" End If Next End Sub
[c#]
private void ClearAllTextBox() { Control _ctrl = default(Control); TextBox _txt = default(TextBox); foreach ( _ctrl in this.Controls) { if ((object.ReferenceEquals(_ctrl.GetType(), typeof(TextBox)))) { _txt = (TextBox)_ctrl; _txt.Text = ""; } } }
Good Info………..Thanks