I'm trying to do this
FolderBrowserDialog dlg = new FolderBrowserDialog();
dlg.RootFolder = "C:\SomeUserSelectedFolder";
But RootFolder
is a System.Environment.SpecialFolder
.
Does this mean I can only set that to places like MyDocuments or the Desktop?!?
That's correct: if the assigned value of RootFolder
is not one of the Environment.SpecialFolder
values then an InvalidEnumArgumentException is raised.
You can set SelectedPath, though:
If the SelectedPath property is set before showing the dialog box, the folder with this path will be the selected folder, as long as SelectedPath is set to an absolute path that is a subfolder of RootFolder (or more accurately, points to a subfolder of the shell namespace represented by RootFolder).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With