How to get a text file name from the application start up folder in vb.net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • selvialagar
    New Member
    • Apr 2008
    • 57

    How to get a text file name from the application start up folder in vb.net

    Hi............. .

    I need to extract a textfile (.txt) file alone from the application startup path. That is I stored a text file in d:\text\inputfi le.txt. The folder contains a text file.but i don't know the file name . Now i have to find the folder whiich contains a text file. If the folder contains a text file, i will take that for processing.Supp ose if the folder does not contains the text file, i will show the openfiledialog to the user. From that he can select a text file from any other path. How can i extract the text file from the folder...Plz give me some suggesstions..
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Do you know how to list the files in a given directory?
    What if there are lots of .txt files in the startup directory? Which one would be chosen?

    Comment

    • Curtis Rutland
      Recognized Expert Specialist
      • Apr 2008
      • 3264

      #3
      Using the System.IO.Direc toryInfo class, you can get all files in a directory, as well as recursively searching it's subdirectories as well. You can apply a filter to your search to just search for *.txt.

      Comment

      • selvialagar
        New Member
        • Apr 2008
        • 57

        #4
        Thank You for your reply.I got it.

        Comment

        Working...