Advertise with us
FolderBrowserDialog Control in C#.Net

FolderBrowserDialog Control in C#.Net

FolderBrowserDialog Control in C#.Net

The FolderBrowserDialog control is used to browse and select a folder. FolderBrowser class in framework provides the FolderBrowserDialog control.

How to use FolderBrowserDialog Control

Drag and drop FolderBrowserDialog control from toolbox on the window Form.

FolderBrowserDialog Control in C#.Net

FolderBrowserDialog Control in C#.Net

Drag and drop button and textbox, a button for showing browser dialog and textbox to show the selected path.

FolderBrowserDialog Control in C#.Net

Code:

Write the code on the Button click event.

FolderBrowserDialog Control in C#.Net

Double click on Click event to open Button click event handler.

private void btnFolderBrowser_Click(object sender,  EventArgs e)
{
            // folderBrowserDialog will open
            folderBrowserDialog1.ShowDialog();
            //selected pathe in folderBrowserDialog will show in textbox
            textBox1.Text = folderBrowserDialog1.SelectedPath;
}

Run the project

FolderBrowserDialog Control in C#.Net

When you click BrowseFile button then FolderBrowserDialog will open.

FolderBrowserDialog Control in C#.Net

Select Folder

FolderBrowserDialog Control in C#.Net

When you select File and click the ok button then the selected path will show in the textbox.

FolderBrowserDialog Control in C#.Net

Last updated:9/6/2020 11:36:20 AM

0 Comments

Leave Comment