CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Guest

    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!


  2. #2
    Join Date
    Dec 1999
    Location
    Israel
    Posts
    101

    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!


  3. #3
    Guest

    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!


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

Featured