Is there a common dialogue to find a folder?

  • Thread starter Thread starter moondaddy
  • Start date Start date
M

moondaddy

Using c# 2.0 in a winforms app, is there a common dialog I can use to allow
users to select a directory? By selecting a folder, the user will be
identifying the location a group of files will be saved to. The dialogue
will return a string path that I will use for this.

Please advise.

Thanks.
 
moondaddy said:
Using c# 2.0 in a winforms app, is there a common dialog I can use to allow
users to select a directory? By selecting a folder, the user will be
identifying the location a group of files will be saved to. The dialogue
will return a string path that I will use for this.

Have a look at FolderBrowserDialog.

Chris.
 
Thanks! this was much better than some sample code I found to make my own
class to do this. Plus, this sample code made it difficult to define the
default folder to open the dialogue to. Your suggestion made it simple.

How to implement a managed component that wraps the Browse For Folder common
dialog box by using Visual C#
http://support.microsoft.com/kb/306285

This works good.


FolderBrowserDialog folderDialog = new
FolderBrowserDialog();
folderDialog.Description = "Select Folder";

folderDialog.SelectedPath = "D:\\somefolder\\Apps";

if (folderDialog.ShowDialog() == DialogResult.OK)
{
MessageBox.Show(folderDialog.SelectedPath);
}
 
Back
Top