String ^SelectedDirectory;
FolderBrowserDialog ^SelectFolderDialog = gcnew FolderBrowserDialog();
//Setup dialog box
SelectFolderDialog->Description = "Select directory to store files to";
SelectFolderDialog->ShowNewFolderButton = true;
SelectFolderDialog->RootFolder = System::Environment::SpecialFolder::Desktop;
try
{
SelectFolderDialog->SelectedPath = SelectedDirectory; //Try and use last selection
}
catch (Exception ^)
{
}
//Display dialog box
if (SelectFolderDialog->ShowDialog() == System::Windows::Forms::DialogResult::OK)
{
SelectedDirectory = SelectFolderDialog->SelectedPath;
//.............
}
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.