System.Windows.Forms.SaveFileDialog saveFileDialog1; saveFileDialog1 = new System.Windows.Forms.SaveFileDialog(); DialogResult dr= saveFileDialog1.ShowDialog(); if (dr==DialogResult.OK) { string filename = saveFileDialog1.FileName; //save file using stream. }
SaveFileDialog oSaveFileDialog = new SaveFileDialog(); oSaveFileDialog.Filter = "All files (*.*) | *.*"; if (oSaveFileDialog.ShowDialog() == DialogResult.OK) { string fileName = oSaveFileDialog.FileName; string extesion = Path.GetExtension(fileName); switch (extesion) { case ".txt"://do something here break; case ".xls"://do something here break; default://do something here break; } }