How to

create file save dialog

Published: 14. December 2008 | Updated: 14. December 2008
License: Microsoft Public License (MS-PL)
Categories: Winforms
Tags: C# File System UI Winforms
Was this snippet helpful for you? YESYES / NONO
Get Analyzant!

Check your entire website from code to content in minutes with Analyzant, the free analysis suite.

Free download at analyzant.com

Import namespace

using System.Windows.Forms;

Code

SaveFileDialog dialog = new SaveFileDialog();
dialog.Title = "Save file as...";
dialog.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*";
dialog.RestoreDirectory = true;

if (dialog.ShowDialog() == DialogResult.OK)
{
    MessageBox.Show(dialog.FileName);
}
Send us feedback about this snippet »



Related Snippets: