Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / VB

Clear All textboxes text in VB

2 Oct 2011CPOL 46.7K  
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.

VB
Dim X As Control
For Each X In Me.Controls
    If TypeOf X Is TextBox Then
        X = ""
    End If
Next X

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)