ive tried searchin for this with no luck, just get a load on IIS server crap etc.. lol anyway..
is it possible in vb to return the Nth file in a directory?
cheers
oo found how to do it here :D
Printable View
ive tried searchin for this with no luck, just get a load on IIS server crap etc.. lol anyway..
is it possible in vb to return the Nth file in a directory?
cheers
oo found how to do it here :D
If you are using the built-in dir() function in VB6 then you will need to start at the top and skip to the file you need.
Alternately you can use the FileSystemObject and it returns a collection of files as a property of the folder object. But you will still need to loop through the collection because it isn't indexed by an integer.
But if you are using VB.Net you can use Io.Directory.GetFiles(path as string) as string() to give you an array of strings--each containing a filename. You could then index directly into the array to get the 'n-th' file.
Hope this answered your question without too much overkill. If you have questions feel free to drop me an email.