How do I open a FolderBrowserDialog at the selected folder?

后端 未结 9 1926
深忆病人
深忆病人 2020-12-15 18:00

I have a FolderBrowserDialog, displayed with code shown below. However, it keeps opening with \'Computer\', i.e. the root of the folder tree, selected. How do I get it to

9条回答
  •  没有蜡笔的小新
    2020-12-15 18:21

    If you set RootFolder to Environment.SpecialFolder.Desktop then it will open to the SelectedFolder as long as the path is valid.

    When you set RootFolder to Environment.SpecialFolder.MyComputer, then the first time the dialog opens, it will always start at MyComputer, not the SelectedFolder path.

    If a valid selection is made, then subsequent uses of the same FolderBrowserDialog instance will open at the previously selected path.

提交回复
热议问题