Resource

How to use a SaveFileDialog in WPF

VB Developer Aug 12 2009
The SaveFileDialog class defined in Microsoft.Win32 namespace represents Windows Save File Dialog control.
    • Like
    • Love It
    • Awesome
    • Interesting
    • It's Okay
    • Thumbs Down
  • 67.9k
  • 0
The SaveFileDialog class defined in Microsoft.Win32 namespace represents Windows Save File Dialog control.

The following code snippet creates a SaveFileDialog, sets its default extension and fiter properties and calls ShowDialog method that displays SaveFileDialog control.


Microsoft.Win32.
SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
dlg.DefaultExt =
".txt";
dlg.Filter =
"Text documents (.txt)|*.txt";
if (dlg.ShowDialog() == true )
{
   string filename = dlg.FileName;
}