)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to use the FolderBrowser control?

Platform: WinForms |
Control: FolderBrowser |
Published Date: April 6, 2015 |
Last Revised Date: May 24, 2019

The FolderBrowser component provides a convenient and easy to use object-oriented wrapper for the Win32 Shell Folder Browser API that helps in accessing the system folders. The following properties are used to set the location of the FolderBrowser control.

 

FolderBrowser Properties

Description

StartLocation

Specifies the location of the root folder from where the browsing is to be started.

CustomStartLocation

Gets or sets the custom start location to show the dialog.

SelectLocation

Gets or sets the selected location to show the dialog.

DirectoryPath

Retrieves the location of the selected folder.

You can set the desired location of the FolderBrowser Dialog points. The StartLocation property provides various options to specify the location of the root folder from where the browsing is to be started. The custom start location of the FolderBrowser can be set by using the property, CustomStartLocation.

The following code example demonstrates the same.

C#

//Sets the custom start location for showing the dialog.
folderBrowser1.CustomStartLocation = textBox1.Text;
//Sets the selected location for showing the dialog
folderBrowser1.SelectLocation = textBox1.Text;
// Sets the start location for the folder browser dialog.
folderBrowser1.StartLocation = FolderBrowserFolder.MyDocuments;
//Retrieves the location of the selected folder.
textBox1.Text = folderBrowser1.DirectoryPath;

VB

'Sets the custom start location for showing the dialog.
folderBrowser1.CustomStartLocation = textBox1.Text
'Sets the selected location for showing the dialog.
folderBrowser1.SelectLocation = textBox1.Text
'Sets the start location for the folder browser dialog.
folderBrowser1.StartLocation = FolderBrowserFolder.MyDocuments
'Retrieves the location of the selected folder.
textBox1.Text = folderBrowser1.DirectoryPath

The screenshot displays the Folder Browser.

Showing folder browser

Figure 1: Folder browser dialog box

Sample Link:

http://www.syncfusion.com/downloads/support/directtrac/136531/FolderBrowser-488198065.zip

 

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon