Prompts the user to select a folder. This class cannot be inherited.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Thetype exposes the following members.
|Container||Gets the IContainer that contains the Component. (Inherited from Component.)|
|Description||Gets or sets the descriptive text displayed above the tree view control in the dialog box.|
|RootFolder||Gets or sets the root folder where the browsing starts from.|
|SelectedPath||Gets or sets the path selected by the user.|
|ShowNewFolderButton||Gets or sets a value indicating whether the New Folder button appears in the folder browser dialog box.|
|Site||Gets or sets the ISite of the Component. (Inherited from Component.)|
|Tag||Gets or sets an object that contains data about the control. (Inherited from CommonDialog.)|
|CreateObjRef||Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)|
|Dispose()||Releases all resources used by the Component. (Inherited from Component.)|
|Equals(Object)||Determines whether the specified object is equal to the current object. (Inherited from Object.)|
|GetHashCode||Serves as the default hash function. (Inherited from Object.)|
|GetLifetimeService||Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|InitializeLifetimeService||Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)|
|Reset||Resets properties to their default values. (Overrides CommonDialog.Reset().)|
|ShowDialog()||Runs a common dialog box with a default owner. (Inherited from CommonDialog.)|
|ShowDialog(IWin32Window)||Runs a common dialog box with the specified owner. (Inherited from CommonDialog.)|
|ToString||Returns a String containing the name of the Component, if any. This method should not be overridden. (Inherited from Component.)|
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 , you set the RootFolder to the location from which to start browsing. Optionally, you can set the SelectedPath to an absolute path of a subfolder of RootFolder that will initially be selected. You can also optionally set the Description property to provide additional instructions to the user. Finally, call the ShowDialog method to display the dialog box to the user. When the dialog box is closed and the dialog box result from ShowDialog is DialogResult.OK, the SelectedPath will be a string containing the path to the selected folder.
You can use the ShowNewFolderButton property to control if the user is able to create new folders with the New Folder button.
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.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.