Results 1 to 3 of 3

Thread: For Loop Not Working [RESOLVED]

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2005
    Posts
    537

    Resolved For Loop Not Working [RESOLVED]

    I am trying to find all of the Textboxes in my form, but its not working. How do I do this?

    VB Code:
    1. dim TXBX as textbox
    2.  
    3. for each txbx in me.controls
    4. msgbox "HERE's ONE!"
    5. next

    Thanks,
    Sir Loin
    Last edited by Sir Loin; Jun 20th, 2005 at 04:39 PM.

  2. #2
    Fanatic Member vbasicgirl's Avatar
    Join Date
    Jan 2004
    Location
    Manchester, UK
    Posts
    1,016

    Re: For Loop Not Working

    i would do it like this.
    VB Code:
    1. Dim ctr As Control
    2.  
    3. For Each ctr In Me.Controls
    4.  If TypeOf ctr Is TextBox Then
    5.   MsgBox "HERE's ONE!"
    6.  End If
    7. Next ctr

    casey.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2005
    Posts
    537

    Re: For Loop Not Working

    Oh, i didn't think about doing it like that...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