There are times when you want to allow the user to browse for files and select one in your Windows Application .

The Winforms provides the FolderBrowserDialog class which can be used to select a file interactively.

How to allow the user to browse for directories in Winforms App using C# ?

Below is a sample code snippet demonstrating how to allow the user to select a file.

FolderBrowserDialog ACfileDialog = new FolderBrowserDialog();
if (ACfileDialog.ShowDialog() == DialogResult.OK)
{
    MessageBox.Show(ACfileDialog.SelectedPath);
}

Leave a Reply

Your email address will not be published. Required fields are marked *

Liked this content?. Please spread the word :)

  • RSS
  • Twitter
    Visit Us
    Follow Me