Click to See Complete Forum and Search --> : Randomly display .bmp files from a particular directory


December 20th, 1999, 01:54 PM
Does anyone have a quick, easy, and memory efficient way of looping through a specific directory to randomly display an image file in a picture box control (all files in this particular directory are .bmp files)? The random display would occur each time they click a command button. The only part I'm stuck on is making the image selection random.

I'm using VB5 in a 95 & NT environment.

Much thanks in advance!

Ruth Glushkin
December 21st, 1999, 01:25 AM
Try to save all the file names into String() array, and randomly get index of each element of this array,
something like this:
Randomize
i = Rnd(...)
Picture1.Picture = LoadPicture(Files(i))

Good Luck!

December 23rd, 1999, 10:54 AM
THANK YOU! THANK YOU! THANK YOU!

I tried to rate your message as Excellent, but I am not registered (maybe I'll get around to it one of these days).

Again, I thank you very much for taking the time to help me out!