How would one write a loop that would print out the contents of the Name property for all control instances on a form??
Printable View
How would one write a loop that would print out the contents of the Name property for all control instances on a form??
P.S. It won't work for arraysCode:Private Sub Form_Load()
Dim Control As Control
For Each Control In Form1
If TypeOf Control Is TextBox Then
MsgBox Control.Name
End If
Next Control
End Sub
Code:Private Sub Command2_Click()
Dim Control As Control
For Each Control In Form1
Printer.Print Control.Name
Next Control
Printer.EndDoc
End Sub
Thanks, It works.