Randomly display .bmp files from a particular directory
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!
Re: Randomly display .bmp files from a particular directory
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!
Re: Randomly display .bmp files from a particular directory
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!