| Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free! |
VB random filename from directory
|
Original Message
|
Name: jamesc
Date: January 15, 2006 at 04:09:19 Pacific
Subject: VB random filename from directory |
Comment: In VB i want to get a random file name for all bmp/jpeg/png (only) files from a specified directory ("c:\pics") and store it as a variable. Any ideas?
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: StuartS
Date: January 16, 2006 at 01:51:30 Pacific
|
Reply: (edit)Use the file list box to get a list of files in the directory. Then use the Rnd function to select one of them Int((File(index)* Rnd ) Will return a number between Zero and the maximum number of files in the list. Stuart
Report Offensive Follow Up For Removal
|
|
Response Number 2
|
Name: jamesc
Date: January 17, 2006 at 13:23:56 Pacific
|
Reply: (edit)That doesnt work. (Even after i add the extra bracket). I have a list stored in an array called 'files' now. All i wanna do is copy a random item from that array into a variable. Can i use Rnd to select an item via it's index and copy it into the variable? Anyone?
Report Offensive Follow Up For Removal
|

Post Locked
This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
Go to Programming Forum Home