Articles in this section
Category / Section

How to use the Folder Browser control in WinForms?

1 min read

The WinForms Folder Browser 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 in WinForms

Figure 1: Folder browser dialog box

Sample Link:

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


Conclusion

I hope you enjoyed learning on how to use the Folder Browser control in WinForms.

You can refer to our WinForms Folder Browser feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms Folder Browser example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!


 


Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied