C
Cerebrus99
Whenever I face such an issue, I find it very useful to use the Container's
Controls collection.
For instance, put all your textboxes in a container control like a Panel or
GroupBox and then iterate through the Controls collection of that Parent
Container, setting the properties as required. If that isn't possible, you
can still treat the Form as a Parent Container (Use the Me.Controls
collection in that case)
---------------------------------------
Dim Ctrl as Control
Dim i as Integer
For i = 0 To Panel1.Controls.Count - 1
Ctrl = Panel1.Controls.Item(i)
If TypeOf (Ctrl) Is TextBox Then
Ctrl.Text = ""
End If
Next
---------------------------------------
Though it doesn't appear to be so, from your example, in case you don't need
the Index nos. of the controls, using a For-each loop is even simpler.
Regards,
Cerebrus.
Controls collection.
For instance, put all your textboxes in a container control like a Panel or
GroupBox and then iterate through the Controls collection of that Parent
Container, setting the properties as required. If that isn't possible, you
can still treat the Form as a Parent Container (Use the Me.Controls
collection in that case)
---------------------------------------
Dim Ctrl as Control
Dim i as Integer
For i = 0 To Panel1.Controls.Count - 1
Ctrl = Panel1.Controls.Item(i)
If TypeOf (Ctrl) Is TextBox Then
Ctrl.Text = ""
End If
Next
---------------------------------------
Though it doesn't appear to be so, from your example, in case you don't need
the Index nos. of the controls, using a For-each loop is even simpler.
Regards,
Cerebrus.