Results 1 to 2 of 2

Thread: working with files (solved)

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    UK
    Posts
    506

    working with files (solved)

    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
    Last edited by adzzzz; Oct 27th, 2002 at 12:00 PM.

  2. #2
    New Member
    Join Date
    Oct 2002
    Location
    Kansas City
    Posts
    2
    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.
    Glenn Powell
    Software Innovations, Inc.
    http://www.software-innovations-inc.com/

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