Results 1 to 6 of 6

Thread: problems with ARRAYS!

  1. #1
    dgr
    Guest

    problems with ARRAYS!

    help!i have an array of images (they are actually a noughts and crosses board) that i wish to change the picture property of. the code I am using is:

    imgsquare().Picture = LoadPicture("Clear.bmp")


    i know i need a snippet of code in the () to select the entire array, but i'm not sure how. i've tried (0 to 8) but that doesn't work, neither does ().

    using (0 to 8) gives a compile error - expected - end of statement.

    using () gives a compile error - method or data member not found...

    this is really bugging me! anyone who thinks they can help please feel free to email me for complete code.

    thanks

    dgr

  2. #2
    Fanatic Member
    Join Date
    Apr 2002
    Posts
    638
    you have to specify what element in the array the picture will go. so...

    VB Code:
    1. imgsquare(0).Picture = LoadPicture("Clear.bmp")


  3. #3
    dgr
    Guest
    thanks for the reply, unofrtunatly this would require me to type the code 9 times, once for each element of the array. not a good use of code...

  4. #4
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    I think this is the shortest way to do it...

    VB Code:
    1. For i = 0 to 9
    2.     imgsquare(0).Picture = LoadPicture("Clear.bmp")
    3. Next i
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  5. #5
    dgr
    Guest
    i think you mean:

    For i = 0 To 9
    imgsquare(i ).Picture = LoadPicture("Clear.bmp")
    Next i


    thanks loads for both of your answers!

    i'll be back soon (to ask another question, or to answer someone elses - when i learn a bit more about vb )

    dgr

  6. #6
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    Originally posted by dgr
    i think you mean:

    For i = 0 To 9
    imgsquare(i ).Picture = LoadPicture("Clear.bmp")
    Next i
    Oops

    Serves me right for doing a cut & paste job
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


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