0

I would like to save the path that the file should be saved at but I do not want the user to add the name of the file and its format. Just select the map where the file should be saved.

The code below doesn't work to save the path because you also need to adda file name.

    SaveFileDialog saveFileDialog = new SaveFileDialog();

    if (saveFileDialog.ShowDialog() == true)
    {
        lblDestination.Content = saveFileDialog.FileName;
    }

Thank you!

HelloWorld1
  • 13,688
  • 28
  • 82
  • 145

2 Answers2

7

Use the FolderBrowserDialog instead, this allows you to pick just the folder.

BugFinder
  • 17,474
  • 4
  • 36
  • 51
3

Sounds like you want the FolderBrowserDialog instead of the SaveFileDialog you're currently using.

Alternatively, if you want to keep the current dialog you have, then Path.GetDirectoryName() will allow you to strip out the file name from saveFileDialog.FileName.

MSDN

AntiTcb
  • 609
  • 4
  • 15