quick VB6 help

Discussion in 'Archived Threads 2001-2004' started by Ryan Peter, Mar 29, 2002.

  1. Ryan Peter

    Ryan Peter Screenwriter

    Joined:
    Sep 15, 1999
    Messages:
    1,220
    Likes Received:
    0
    Trophy Points:
    0
    I have some different variable names and object names such as myName1, myName2, myName3, etc. They all have the same name, just a different sequential number at the end. Now what I want to do is manipulate those variables in a Do While, or While/Wend loop.



    So basically have it loop through and every time it has to go through the loop, the specific variable it attacks is incremented.



    for exp.



    While x < 21

    i = 1

    lblDisplay.Visible = True

    lblDisplay.Caption = x

    x + 1

    i + 1

    Wend



    I could do this in JavaScript pretty well, but I can't seem to figure out how to do it in VB6.



    Thanks if you can help!
     
  2. Shayne Lebrun

    Shayne Lebrun Screenwriter

    Joined:
    Jun 17, 1999
    Messages:
    1,086
    Likes Received:
    0
    Trophy Points:
    0
    Try using an array.
     
  3. Shayne Lebrun

    Shayne Lebrun Screenwriter

    Joined:
    Jun 17, 1999
    Messages:
    1,086
    Likes Received:
    0
    Trophy Points:
    0
    Ooops, let me read your post. If you're iterating through a bunch of button objects, try using either an object array, or don't treat them as variables, use an object loop

    FOR EACH button IN form

    button.label = 'blah blah'

    button.visible = False

    next

    or some such.

    I think there's a wee bit more you need to do to get that work, but that's the general idea.
     

Share This Page