Using Visual Studio 2015, I am writing a Windows Form Application in C#. I use the following code:
FolderBrowserDialog dialog = new FolderBrowserDialog();
dialog.RootFolder = Environment.SpecialFolder.MyComputer;
On my development machine (Windows 8.1) this works as expected, the FolderBrowserDialog
appears with "This Computer" as the root directory.
However when I transfer the program to a windows 10 machine (I have tried both pro and home versions of Windows 10) the FolderBrowserDialog
opens with "Desktop" as to root directory.
Is there a different SpecialFolder
that I should be using specific to Windows 10?
I know MyComputer was renamed to ThisPC in Windows 8 and 10 so interesting that would work in 8 but not 10. What path do you get if you run this:
string myComputerPath = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer);
Does it resolve to 'This PC'.
Also you could try this, which gets the path by the MyComputer Guid:
FolderBrowserDialog dialog = new FolderBrowserDialog();
dialog.SelectedPath = "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}";
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