vb清空文本框的代码

如果您使用的是VB.NET,可以使用以下代码清空文本框:

TextBox1.Text = “”

如果您使用的是VB6,则可以使用以下代码:

Text1.Text = “”

如果您想要清空多个文本框,可以使用以下代码:

VB.NET:

TextBox1.Text = “”
TextBox2.Text = “”
TextBox3.Text = “”

或者使用循环:

For Each tb As TextBox In Me.Controls.OfType(Of TextBox)()
tb.Text = “”
Next

VB6:

Text1.Text = “”
Text2.Text = “”
Text3.Text = “”

或者使用循环:

Dim ctl As Control
For Each ctl In Me.Controls
If TypeOf ctl Is TextBox Then
ctl.Text = “”
End If
Next ctl