private void SavetxtData_Click(object sender, EventArgs e) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "(*.txt)|*.txt|(*.*)|*.*"; saveFileDialog.FileName = "文件" + DateTime.Now.ToString("yyyyMMddHHmm") + ".txt"; //将日期时间作为文件名 if (saveFileDialog.ShowDialog() == DialogResult.OK) { StreamWriter streamWriter = new StreamWriter(saveFileDialog.FileName, true); streamWriter.Write(this.rxtextBox.Text); streamWriter.Close(); } }
|
请发表评论