HomeCSharpBrowse for a directory using FolderBrowserDialog in Winforms

Browse for a directory using FolderBrowserDialog in Winforms

When developing a Windows Application , the developers can use the FolderBrowserDialog control which lets the user to select a directory.

Browse for a directory using FolderBrowserDialog in Winforms

Below is a sample code snippet demonstrating how to use the FolderBrowserDialog control using C# .

string FolderGKPath = "";
FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
{
    FolderGKPath  = folderBrowserDialog.SelectedPath ;
}

The SelectedPath property of the FolderBrowserDialog control returns the path of the directory that was selected.

Leave a Reply

You May Also Like

This C# program calculates and displays an upper triangular matrix based on user input. Problem Statement: The program takes the...
This C# program serves as a demonstration of bitwise operators, which are fundamental operators used for manipulating individual bits in...
This C# program is designed to interchange or swap the columns of a matrix. A matrix is a two-dimensional array...