Reputation: 72
everyone.I'm just confused that how could i select a folder with the SaveFileDialog.Is there any way to customize the SaveFileDialog to allow select a folder?Looking forward to your suggestion.
Upvotes: 1
Views: 7107
Reputation: 223257
Use FolderBrowserDialog instead of SaveFileDialog.
Prompts the user to select a folder.
Example from MSDN.
DialogResult result = folderBrowserDialog1.ShowDialog();
if( result == DialogResult.OK )
{
string folderName = folderBrowserDialog1.SelectedPath;
//........
}
Upvotes: 6
Reputation: 82335
Instead of using the SaveFileDialog
consider using the FolderBrowserDialog
for selecting a folder.
This will allow you to select a folder path, otherwise selecting a folder with the SaveFileDialog
is nuanced at best and not recommended.
Upvotes: 2