Results 1 to 4 of 4

Thread: Loading An Image List

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2002
    Posts
    27

    Loading An Image List

    Hi this seems to be a tough one for me but i hope someone here can help

    i have a huge list of images (huge being well over 1000)

    what would be the fastest way to load them imto VB??
    at the moment it goes through this list picture by picture then it loads each images into a picture box like this
    picture(n).picture = loadpicture(selected & ".gif")
    selected is the name of the image that is to be loaded ehich is the 1 it is up to in the list

    ne suggestions??
    martyn

  2. #2
    Lively Member
    Join Date
    Mar 2002
    Posts
    110
    name your images by number, for example image0.gif, image1.gif, etc. then load each image into a picture array using a loop

    dim myImages(1000) as picture
    dim i%

    for i = 0 to 999

    'set the path to wherever you have the images saved
    set myImages(i) = LoadPicture(app.path & "\images\image" & _
    i & ".gif")

    next i

    'now you can just reference the picture using the variable
    picture1.picture = myImages(1)
    image1.picture = myImagaes(2)
    ...etc

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Jul 2002
    Posts
    27
    cheers
    that speeds it up quite a bit as im using the same images many times and it saves loading the same images again and again. is there any way i can call each image by text rather than a number? eg
    picture1.picture = myimages("A0A0")

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Jul 2002
    Posts
    27
    dont worry i hav sorted it
    i used the code u gave (which was a huge help and much faster) then added each one 2 a collection and gave it a name and called each picture from the collecetion

    thanks for the help
    martyn

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