Directory picker control in .net

  • Thread starter Thread starter Shahzad Atta
  • Start date Start date
S

Shahzad Atta

Hi All,

I am using visual studio .net with C#. I need to take directory path input
from user. First I thought to use fileopen dialog but that will allow the
user to select files. However, what I want is that user should be able to
pick directories only not files. Any idea how to do that ?

Regards,
Shahzad Atta.
 
If you are using the 1.1 Framework - there's a FolderBrowserDialog.

However the 'easy' way to do this is to use a Treeview to simulate windows
explorer for instance - use the DirectoryInfo class to populate the
directories and the FileInfo class to populate the file information.

This should get you through it
http://www.codeproject.com/csharp/AdvancedFileExplorer.asp
 
Shahzad,

When you use Net 1.1 is the easy way to do that is to use the
folderbrowserdialog.

It had a while a bug, however that is gone by the Net 1.1 sp1.

To overcome that bug a lot of people made a treeview, however that is not
needed anymore.

I hope this helps?

Cor
 
Ryan and Cor thanks a lot!
I do have .Net framework1.1 and I think FolderBrowserDialog is an obvious
choice.
 
Back
Top