-
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
-
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
-
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")
-
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