Control Arrays in VB

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MrMojoRisin
    New Member
    • Jun 2006
    • 1

    #1

    Control Arrays in VB

    Ok, there are many posts all over the net with possible solutions to this challenge, but none seem to suit my needs. in the 'good ol' days' (VB6 and Prior) you could simply copy/paste controls to a form and set Index properties to create an array of controls. These could then be manipulated individualy, for example:

    MyTextBox(1).Te xt ="I"
    MyTextBox(1).Te xt ="WOZ"
    MyTextBox(1).Te xt ="'ERE"

    But I can't find a simple solution to create an array of 132 picture boxes.
    I don't need anything fancy, just to be able to address each box individually with an index.

    Any help would be much appreciated, and keep my barber in business a bit longer!

    Thank, MrMojo.
  • BSOB
    New Member
    • Jul 2006
    • 77

    #2
    By "Simple"... im sure you could copy and past a picture box 131 times. you dont have to count either, look at the "index" of the last object to see what number you are on. the first time you copy/past it will ask if you want a control array, say yes, and all the next ones will be included. the code will be exactly as you expect, just with a higher number of posibilities.
    Now... if by "Simple" you want a complex way... you could write a short script to copy and past it for you 131 times

    for x = 0 to 131
    sendkeys ("^c^v")
    next x

    and start with the picture box highlighted.

    Comment

    Working...