See Also: FolderBrowserDialog Members
This class provides a way to prompt the user to browse, create, and eventually select a folder. Use this class when you only want to allow the user to select folders, not files. Browsing of the folders is done through a tree control. Only folders from the file system can be selected; virtual folders cannot.
Typically, after creating a new System.Windows.Forms.FolderBrowserDialog, you set the FolderBrowserDialog.RootFolder to the location from which to start browsing. Optionally, you can set the FolderBrowserDialog.SelectedPath to an absolute path of a subfolder of FolderBrowserDialog.RootFolder that will initially be selected. You can also optionally set the FolderBrowserDialog.Description property to provide additional instructions to the user. Finally, call the CommonDialog.ShowDialog method to display the dialog box to the user. When the dialog box is closed and the dialog box result from CommonDialog.ShowDialog is DialogResult.OK, the FolderBrowserDialog.SelectedPath will be a string containing the path to the selected folder.
You can use the FolderBrowserDialog.ShowNewFolderButton property to control if the user is able to create new folders with the New Folder button.
System.Windows.Forms.FolderBrowserDialog is a modal dialog box; therefore, when shown, it blocks the rest of the application until the user has chosen a folder. When a dialog box is displayed modally, no input (keyboard or mouse click) can occur except to objects on the dialog box. The program must hide or close the dialog box (usually in response to some user action) before input to the calling program can occur.