Export (0) Print
Expand All

FolderBrowserDialog.SelectedPath Property

Gets or sets the path selected by the user.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public function get SelectedPath () : String 
public function set SelectedPath (value : String)

Property Value

Type: System.String
The path of the folder first selected in the dialog box or the last folder selected by the user. The default is an empty string ("").

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

If the ShowDialog returns OK, meaning the user clicked the OK button, the SelectedPath property will return a string containing the path to the selected folder. If ShowDialog returns 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.

The following code example creates an application that enables the user to open rich text (.rtf) files within the RichTextBox control.

No code example is currently available or this language may not be supported.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1

Community Additions

ADD
Show:
© 2014 Microsoft