PDA

Click to See Complete Forum and Search --> : Syntax for clearing Textboxes


Dec 31st, 1999, 12:40 PM
I want to use something like this:
For i = Forms.Count - 1 To 1 Step -1
Unload Forms(i)
Next

Is there a way to so this with all the textbox controls instead of forms?

Dec 31st, 1999, 01:16 PM
Option Explicit

Private Sub Form_Load()
Dim ctl As Control
For Each ctl In Form1.Controls
If TypeOf ctl Is TextBox Then
ctl.Text = ""
End If
Next
End Sub

Dec 31st, 1999, 01:42 PM
Many thanks! This is exactly what I was looking for.