Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

N00b VB6 question number 2

  • 21-05-2003 10:10AM
    #1
    Registered Users, Registered Users 2 Posts: 3,779 ✭✭✭


    Hello :)


    how do you loop all your elements in a control array ?

    I have a control array of lblName set up and want to go through them all.

    I thought

    for i = 0 to UBound(lblName)

    might work but it generats an error

    'expected array'

    please help this newbie :D


Comments

  • Registered Users, Registered Users 2 Posts: 15,443 ✭✭✭✭bonkey


    This will do it :

    For i = Label1.LBound To Label1.UBound

    Bear in mind, though, that a control array does not have to have sequential index numbers (e.g. you can create a control array with label1(0) and label1(2) in it, without label1(1) existing.

    So you'll also need some error handling, or some other check to see if the control exists.

    A better bet may be to look at the For Each loop. Check up the help on that...it should tell you everything you need to know.

    jc


Advertisement