folderbrowserdialog selectedpath returns 无值

folderbrowserdialog selectedpath returns no value

private void button3_Click(object sender, EventArgs e)
{
    FolderBrowserDialog folderfinder = new FolderBrowserDialog();
    folderfinder.Description = "Select Folder";
    folderfinder.RootFolder = Environment.SpecialFolder.MyComputer;
    folderfinder.ShowNewFolderButton = false;

    Console.Write(folderfinder.SelectedPath);
}

下面的代码总是returns "" for selectedpath。有人看到这里有什么问题吗?我用谷歌搜索了一下,没有人提到 selectedpath 没有返回任何值的问题。

你应该显示对话框 (msdn):

if (folderfinder.ShowDialog() == DialogResult.OK)
{
    Console.Write(folderfinder.SelectedPath);
}