Getting Started with WinForms Folder Browser

18 Nov 20183 minutes to read

Assembly deployment

Refer to the control dependencies section to get the list of assemblies or NuGet package that needs to be added as a reference to use the control in any application.

You can find more details about installing the NuGet package in a Windows Forms application in the following link:

How to install nuget packages

Create a simple application with WinForms Folder Browser

You can create a Windows Forms application with the WinForms Folder Browser control using the following steps:

Create a project

Create a new Windows Forms project in Visual Studio to select the a folder using the WinForms Folder Browser control.

Add control through designer

The WinForms Folder Browser control can be added to an application by dragging it from the toolbox to a designer view. The Syncfusion.Shared.Base assembly reference will be added automatically to the project.

wf domain up down control added by designer

Add control manually in code

To add the control manually in C#, follow the given steps:

  1. Add the Syncfusion.Shared.Base assembly reference to the project.

  2. Include the WinForms Folder Browser control namespace Syncfusion.Windows.Forms;.

    using Syncfusion.Windows.Forms.Tools;
    Imports Syncfusion.Windows.Forms.Tools
  3. Create a WinForms Folder Browser control instance, and invoke the FolderBrowser.ShowDialog() method to display the dialog.

    //FolderBrowser instance
    FolderBrowser folderBrowser1;
       
    folderBrowser1 = new FolderBrowser();
    // Specify the Start location.
    this.folderBrowser1.StartLocation = Syncfusion.Windows.Forms.FolderBrowserFolder.MyComputer;
       
    // Specify the styles for the FolderBrowser Dialog.
    this.folderBrowser1.Style = (Syncfusion.Windows.Forms.FolderBrowserStyles.RestrictToFilesystem | Syncfusion.Windows.Forms.FolderBrowserStyles.BrowseForComputer);
       
    //Display the folder browser dialog window
    this.folderBrowser1.ShowDialog();
    'FolderBrowser instance
    Private folderBrowser1 As FolderBrowser
       
    InitializeComponent()
    folderBrowser1 = New FolderBrowser()
       
    ' Specify the Start location.
    Me.folderBrowser1.StartLocation = Syncfusion.Windows.Forms.FolderBrowserFolder.MyComputer
       
    ' Specify the styles for the FolderBrowser Dialog.
    Me.folderBrowser1.Style = (Syncfusion.Windows.Forms.FolderBrowserStyles.RestrictToFilesystem Or Syncfusion.Windows.Forms.FolderBrowserStyles.BrowseForComputer)
       
    'Display the folder browser dialog window
    Me.folderBrowser1.ShowDialog()

wf folder browser

Auto complete file path

The WinForms Folder Browser control supports editing folder location and auto-complete, which displays available folder paths in a drop-down list to choose by setting its Style to ShowTextBox.

this.folderBrowser1.Style = Syncfusion.Windows.Forms.FolderBrowserStyles.ShowTextBox;
Me.folderBrowser1.Style = Syncfusion.Windows.Forms.FolderBrowserStyles.ShowTextBox

wf folder browser auto complete path