Is it possible to make a FolderBrowserDialog's default path show up in a library instead of the actual disk?

前端 未结 4 1701
梦谈多话
梦谈多话 2021-01-07 18:26

I know that if I set SelectedPath before I show the dialog I can get it to have a folder open by default when the dialog opens. However, the folder I want to us

4条回答
  •  天涯浪人
    2021-01-07 18:46

    Set your root folder and selected path as such and it will auto-scroll there for you on the dialog opening:

    FolderBrowserDialog dlg = new FolderBrowserDialog();
    dlg.RootFolder = Environment.SpecialFolder.MyComputer;
    dlg.SelectedPath = @"E:\Vetcentric";
    dlg.ShowDialog();
    

    enter image description here

    The problem you run into is that if you watch the property assignments after selecting a folder located in the libraries hierarchy, it will still assign it to the genereic path that you would get via going through my computer.

提交回复
热议问题