How to open a folder selection dialog in c# Windows Forms App

How to open a folder selection dialog in c# Windows Forms App

using (var folderBrowserDialog = new FolderBrowserDialog())
{
    DialogResult result = folderBrowserDialog.ShowDialog();
    if (result == DialogResult.OK && !string.IsNullOrEmpty(folderBrowserDialog.SelectedPath))
    {
        var selectedPath = folderBrowserDialog.SelectedPath;
    }
}
Scroll to Top