【发布时间】:2013-04-18 08:31:46
【问题描述】:
使用 winforms,当我右键单击文件夹或尝试删除 FolderBrowserDialog 中的文件夹时,窗口变得无响应,我必须强制关闭它。
代码如下:
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;
}
}
【问题讨论】:
-
你在 txtBoxLog.Text 中给出了什么?
-
我将它设置为 C:\temp\。该文件夹存在,其路径已在对话框中正确打开。
-
尝试以编程方式创建:FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog();而不是使用工具箱中的 FolderBrowserDialog 控件。
-
无事可做。我现在正在尝试扩展该类以获得解决方法。
-
如你所愿:) 干杯!!
标签: c# winforms folderbrowserdialog