CSharp examples for System.Windows.Forms:Dialog
Save File with SaveFileDialog
using System.Windows.Forms; using System.Text; using System.Linq; using System.Collections.Generic; using System;/*from w ww . j a v a2 s .c o m*/ public class Main{ public static string SaveFile(string defaultExt = "") { string filPath = string.Empty; SaveFileDialog dialog = new SaveFileDialog(); if (!string.IsNullOrWhiteSpace(defaultExt)) { dialog.DefaultExt = defaultExt; dialog.AddExtension = true; } dialog.Filter = "????(*.*)|*.*"; dialog.FilterIndex = 0; dialog.DereferenceLinks = true; dialog.RestoreDirectory = false; if (dialog.ShowDialog() == DialogResult.OK) { filPath = dialog.FileName; } return filPath; } }