Search code examples
c#winformsfolderbrowserdialog

Windows Forms FolderBrowserDialog hangs the application


With winforms, when I right click on a folder or try to delete a folder within the FolderBrowserDialog the window becomes irresponsive and I've to force-close it.

Here's the code:

private void btnOpenFileDialog_Click(object sender, EventArgs e)
{
    folderBrowserDialog1.SelectedPath = txtBoxLog.Text;
    folderBrowserDialog1.RootFolder = Environment.SpecialFolder.MyComputer;
    if (folderBrowserDialog1.ShowDialog()==DialogResult.OK)
    {
        txtBoxLog.Text = folderBrowserDialog1.SelectedPath;
    }
}

Solution

  • The problem was system wide, so the control was correctly behaving in an incorrect way (irony).