Results 1 to 4 of 4

Thread: For Loops using control instances

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    3
    How would one write a loop that would print out the contents of the Name property for all control instances on a form??

  2. #2
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523

    Didn't test it!!!!

    Code:
    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
    P.S. It won't work for arrays

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    Private Sub Command2_Click()
    
        Dim Control As Control
        
        For Each Control In Form1
            Printer.Print Control.Name
        Next Control
    
            Printer.EndDoc
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  4. #4

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    3

    Thumbs up Loop for printing control instances on forms

    Thanks, It works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width