Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Clear all text boxes on a form in a forEach loop
Message
From
17/12/2002 15:04:28
 
 
To
All
General information
Forum:
Visual Basic
Category:
Other
Title:
Clear all text boxes on a form in a forEach loop
Miscellaneous
Thread ID:
00733822
Message ID:
00733822
Views:
53
I recently used the algorithm:

Public Sub setPropsOnNavRoutineButtons(condition)
' Loops through each control on the form and sets the enabled condition
Dim formControl As Control
For Each formControl In frmNavRoutines.Controls()
formControl.Enabled = condition
Next formControl
End Sub

to enable/disable all the command buttons on a form.

I now have a need to clear all textboxes on a form with controls other than just text boxes.

I tried:

Public Sub clearFields()
'Loops through each textbox on the form and sets text = ""
Dim tBox As textBox
'For Each textBox In frmHomeSchoolTable.Controls()
For Each tBox In gActiveForm.Controls()
tBox.Text = ""
Next tBox
End Sub

Blows on the for each statement (data type mismatch). Any ideas??
thanx
Next
Reply
Map
View

Click here to load this message in the networking platform