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