65.9K
CodeProject is changing. Read more.
Home

Clear All textboxes text in VB

Sep 29, 2011

CPOL
viewsIcon

46653

Clear All textboxes text in VB

If you want to clear all the textboxes in VB, then instead of setting property of each by calling the name we can set it by using the below code. In this, we will read all the controls and if the control is a textbox, then we set it to blank.
Dim X As Control
For Each X In Me.Controls
    If TypeOf X Is TextBox Then
        X = ""
    End If
Next X