Home > Back-end >  Get file path stored to string var with SaveFileDialog C# WPF
Get file path stored to string var with SaveFileDialog C# WPF

Time:02-02

I am creating an installer and i would like to know how to use SaveFileDialog to get the file path where the user wants to install their mod to. The user should be able to click a button to open up the dialog, navigate to the folder and click select folder and once done is clicked have it stored as {DownloadPath}.

CodePudding user response:

Try looking at the documentation

There is also a tutorial on this.

CodePudding user response:

    var filePath = string.Empty;

    var saveFileDialog = new SaveFileDialog
    {
        Filter = @"Exe Files (.exe)|*.exe|All Files (*.*)|*.*"
    };

    saveFileDialog.ShowDialog();
    if (saveFileDialog.FileName != string.Empty)
    {
        filePath = saveFileDialog.FileName;
    }
  •  Tags:  
  • Related