Home > DeveloperSection > Beginner > FolderBrowserDialog Control in C#.Net

FolderBrowserDialog Control in C#.Net


C# C# 
Ratings:
0 Comment(s)
 15376  View(s)
Rate this:

FolderBrowserDialog Control in C#.Net

A 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, button for showing browser dialog and textbox to show the selected path.

FolderBrowserDialog Control in C#.Net

Code:

Write code on 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 ok button then selected path will show in the textbox.

FolderBrowserDialog Control in C#.Net


Don't want to miss updates? Please click the below button!

Follow MindStick