Hi,
I know it is possible to set the current folder of the OpenFolderDialog to a special folder, like "Program Files" or Desktop?
But where do I find this?
Hi,
I know it is possible to set the current folder of the OpenFolderDialog to a special folder, like "Program Files" or Desktop?
But where do I find this?
Look at the System.Environment class, e.g:
string programFiles = System.Environment.GetFolderPath(
System.Environment.SpecialFolder.ProgramFiles);
Update:
I'm not sure if this is part of the question, but to open the folder selection dialog, you then use this code:
using System.Windows.Forms;
//...
FolderBrowserDialog dialog = new FolderBrowserDialog();
dialog.SelectedPath = programFiles;
dialog.ShowDialog();
string selectedPath = dialog.SelectedPath;
Have you tried setting the folder to System.Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)
? This should do the trick.
You could simply set the initial folder of the OpenFolderDialog
to the result of System.Environment.GetFolderPath()
.