General information
Title:
Clear all text boxes on a form in a forEach loop
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only