How do I open a FolderBrowserDialog at the selected folder?

后端 未结 9 1896
深忆病人
深忆病人 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:06

    From the Microsoft help for FolderBrowserDialog class:

    Typically, after creating a new FolderBrowserDialog, you set the RootFolder to the location from which to start browsing. Optionally, you can set the SelectedPath to an absolute path of a subfolder of RootFolder that will initially be selected.

    Are you possibly setting the SelectedPath to a location that doesn't equate to a subfolder of RootFolder (i.e. My Computer)? That would probably cause it to dive back to the RootFolder as the presented location.

提交回复
热议问题