By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,564 Members | 804 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,564 IT Pros & Developers. It's quick & easy.

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

P: 57
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\inputfile.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.Suppose 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..
Aug 19 '08 #1
Share this Question
Share on Google+
3 Replies


10K+
P: 13,264
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?
Aug 19 '08 #2

Curtis Rutland
Expert 2.5K+
P: 3,256
Using the System.IO.DirectoryInfo 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.
Aug 19 '08 #3

P: 57
Thank You for your reply.I got it.
Aug 21 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.