Results 1 to 5 of 5

Thread: 2dimensional array

  1. #1

    Thread Starter
    Hyperactive Member Petergotchi's Avatar
    Join Date
    Jan 2002
    Location
    Dendermonde - Belgium
    Posts
    267

    2dimensional array

    Is it possible to create a 2dimensional control array?
    I want to be able to call the controls like Text1(1,3).text = ...
    Possible with VB6 or not?
    Kind Regards,

    Pieter

    PS: If you found someone's answer helpful, please be so kind to rate that person.
    Thanks.

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106
    It isn't possible, but why would you want to? If the reason is so that you can do a row and column type thing, you are probably better off with a single dimension array.

  3. #3

    Thread Starter
    Hyperactive Member Petergotchi's Avatar
    Join Date
    Jan 2002
    Location
    Dendermonde - Belgium
    Posts
    267
    Euhm... Explain...
    Indeed I need rows and columns... That's why I want to structure it. I'm making a mastermind game...
    Kind Regards,

    Pieter

    PS: If you found someone's answer helpful, please be so kind to rate that person.
    Thanks.

  4. #4
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    You can't create a two dimensional control array but you can simulate an array of controls.
    VB Code:
    1. Dim aGameBoard(9,4) as TextBox '10 x 5
    2.  
    3. Set aGameBoard(0,0) = Text1
    4. Set aGameBoard(0,1) = Text2
    5. '...etc
    6. Set aGameBoard(9,4) = Text50
    7.  
    8. 'or if each row is a control array of Textboxes
    9. Set aGameBoard(0,0) = Text1(0)
    10. Set aGameBoard(0,1) = Text1(2)
    11. 'etc..
    12. Set aGameBoard(9,4) = Text10(4)
    13.  
    14. 'now access the textboxes through the array.
    15. aGameBoard(1,3).Text = "Hello World"

  5. #5

    Thread Starter
    Hyperactive Member Petergotchi's Avatar
    Join Date
    Jan 2002
    Location
    Dendermonde - Belgium
    Posts
    267
    Wow... Very nice... Thx a lot, brucevde!
    Kind Regards,

    Pieter

    PS: If you found someone's answer helpful, please be so kind to rate that person.
    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