Results 1 to 3 of 3

Thread: Number of controls on a form

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2002
    Posts
    54

    Number of controls on a form

    Is there a way for VB to return an integer value for how many text boxes or labels are on a form?

    I wish to use iteration to check for void inputs, and I am assuming I can use syntax within the loop similar to:_

    IF txtBox[number]="" THEN
    'Error message here'

    Thanks

  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    if you want to use the syntax that you suggested, you have to make a control array.

    then you can do things like this

    VB Code:
    1. Private Sub Command1_Click()
    2.     Dim i As Integer
    3.     For i = 0 To Text1.UBound
    4.         Debug.Print Text1(i).Text
    5.     Next i
    6. End Sub

    that what you want ?
    -= a peet post =-

  3. #3
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695

    Re: Number of controls on a form

    Originally posted by slaphead109
    Is there a way for VB to return an integer value for how many text boxes or labels are on a form?

    I wish to use iteration to check for void inputs, and I am assuming I can use syntax within the loop similar to:_

    IF txtBox[number]="" THEN
    'Error message here'

    Thanks
    see the attachment...

    Cheers...
    Attached Files Attached Files

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