Visual Basic 2008 Tutorials
 

Back | Index

 

Clear all TextBoxes on a Form

The following code is for Clear Text Button.click event:

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Dim a As Control

For Each a In Me.Controls

If TypeOf a Is TextBox Then

a.Text = Nothing

End If

Next

End Sub