Is there a common dialogue to find a folder?

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.
 
C

Chris Shepherd

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.
 
M

moondaddy

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);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top