Results 1 to 3 of 3

Thread: Question about the "For Each...Next" statement

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2002
    Location
    Grand Rapids, MI
    Posts
    166

    Question about the "For Each...Next" statement

    Hello all! I am trying to use the VB5 "For Each...Next" statment to cycle through all of the controls within a frame control. The VB help file is not giving me much help in this regards. Is this something I can do? If so, how would I go about doing it?

    Thanks much!

  2. #2
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141
    I can't say about VB5 but this works in 6.
    VB Code:
    1. Private Sub Command1_Click()
    2. Dim ctl As Control
    3.  
    4.     For Each ctl In Controls
    5.         If ctl.Container Is Frame1 Then
    6.             Me.Print ctl.Name
    7.         End If
    8.     Next ctl
    9. End Sub

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 2002
    Location
    Grand Rapids, MI
    Posts
    166
    That did the trick! Thanks!!!

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