using System.IO; System.Windows.Forms.SaveFileDialog objSave = new System.Windows.Forms.SaveFileDialog();objSave.Filter = "(*.txt)|*.txt|" + "(*.*)|*. ...
using System.IO;
System.Windows.Forms.SaveFileDialog objSave = new System.Windows.Forms.SaveFileDialog();
objSave.Filter = "(*.txt)|*.txt|" + "(*.*)|*.*";
objSave.FileName = "文件" + DateTime.Now.ToString("yyyyMMddHHmm") + ".txt";
if (objSave.ShowDialog() == DialogResult.OK)
{
StreamWriter FileWriter = new StreamWriter(objSave.FileName, true); //寫文件
FileWriter.Write(this.txtDetail.Text);//將字元串寫入
FileWriter.Close(); //關閉StreamWriter對象
}