System.Windows.Forms.FolderBrowserDialog.SelectedPath Property

Gets or sets the path selected by the user.

Syntax

[System.ComponentModel.Localizable(true)]
[System.ComponentModel.Editor("System.Windows.Forms.Design.SelectedPathEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(System.Drawing.Design.UITypeEditor))]
[System.ComponentModel.DefaultValue("")]
[System.ComponentModel.Browsable(true)]
public string SelectedPath { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

If the FolderBrowserDialog.SelectedPath property is set before showing the dialog box, the folder with this path will be the selected folder, as long as FolderBrowserDialog.SelectedPath is set to an absolute path that is a subfolder of FolderBrowserDialog.RootFolder (or more accurately, points to a subfolder of the shell namespace represented by FolderBrowserDialog.RootFolder).

If the CommonDialog.ShowDialog returns DialogResult.OK, meaning the user clicked the OK button, the FolderBrowserDialog.SelectedPath property will return a string containing the path to the selected folder. If CommonDialog.ShowDialog returns DialogResult.Cancel, meaning the user canceled out of the dialog box, this property will have the same value that it had prior to displaying the dialog box. If the user selects a folder that does not have a physical path (for example, My Computer), the OK button on the dialog box will be disabled.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0