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

Selecting a folder and all contents within

P: 82
I am using with visual studio 2008. I have the need to have a user select a directory on a network drive to bring up a folder with a very extensive list of files. The file names within this directory are what I'm concerned with and I will need to write all these file names to a textfile in order to do a comparison with an existing text file. The user must be able to select this folder themselves.

At this point I am trying to use the openfiledialog box to open the folder however it is requiring that I select a specific file which is not my need. I need the whole folder.
I currently have a filter that is allowing all files.
Expand|Select|Wrap|Line Numbers
  1. fdlg.Filter = "All files (*.*)|*.*|All files (*.*)

I assume that there is another way to do this but I am currently unaware of that way.

Any suggestions would be greatly appreciated.
Jul 16 '10 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 449
Instead of using OpenFileDialog you can go in for FolderBrowserDialog.. which displays only folder view..

Get the Seelcted folder and by Directory.GetFiles()
(or something like that) get all files under the selected folder
Jul 19 '10 #2

Post your reply

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