Export (0) Print
Expand All

FolderBrowserDialog Class

Prompts the user to select a folder. This class cannot be inherited.

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

[<Sealed>]
type FolderBrowserDialog =  
    class 
        inherit CommonDialog 
    end

The FolderBrowserDialog type exposes the following members.

  NameDescription
Public methodFolderBrowserDialogInitializes a new instance of the FolderBrowserDialog class.
Top

  NameDescription
Public propertyContainerGets the IContainer that contains the Component. (Inherited from Component.)
Public propertyDescriptionGets or sets the descriptive text displayed above the tree view control in the dialog box.
Public propertyRootFolderGets or sets the root folder where the browsing starts from.
Public propertySelectedPathGets or sets the path selected by the user.
Public propertyShowNewFolderButtonGets or sets a value indicating whether the New Folder button appears in the folder browser dialog box.
Public propertySiteGets or sets the ISite of the Component. (Inherited from Component.)
Public propertyTagGets or sets an object that contains data about the control. (Inherited from CommonDialog.)
Top

  NameDescription
Public methodCreateObjRefCreates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)
Public methodDispose()Releases all resources used by the Component. (Inherited from Component.)
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetLifetimeServiceRetrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodInitializeLifetimeServiceObtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Public methodResetResets properties to their default values. (Overrides CommonDialog.Reset().)
Public methodShowDialog()Runs a common dialog box with a default owner. (Inherited from CommonDialog.)
Public methodShowDialog(IWin32Window)Runs a common dialog box with the specified owner. (Inherited from CommonDialog.)
Public methodToStringReturns a String containing the name of the Component, if any. This method should not be overridden. (Inherited from Component.)
Top

  NameDescription
Public eventDisposedOccurs when the component is disposed by a call to the Dispose method. (Inherited from Component.)
Public eventHelpRequestInfrastructure. Occurs when the user clicks the Help button on the dialog box.
Top

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 FolderBrowserDialog, 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.

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.

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.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

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.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft