Loop Through Textboxes

g7bmp

New member
Joined
Jun 6, 2007
Messages
2
Programming Experience
Beginner
Can Any one help with this i am trying to loop through the text boxes on a form
i have tried
Private Sub SetControls()
Dim cControl As Control
For Each cControl InMe.Controls
If (TypeOf cControl Is TextBox) Then
cControl.Text = "abc"
End If
Next cControl
End Sub
This only gives me the main controls panel and tabs etc it does not give me the text boxes on these controls
Thanks in Advance
nick

Visual studio .net
 
You need to specify the name of the container. For example, if your textboxes are contained in a groupbox named grpBoxes, then your code should be:

For Each cControl In Me.grpBoxes.Controls
 
Back
Top