110,502
社区成员
发帖
与我相关
我的任务
分享
private void button1_Click(object sender, EventArgs e)
{
string path = this.textBox1.Text.Trim();
StreamWriter sw = File.AppendText(path);
sw.WriteLine(this.textBox2.Text.Trim());
sw.Close();
MessageBox.Show("写入成功!");
}
using SYSTEM.IO;
//C#追加文件
StreamWriter sw=File.AppendText(Server.MapPath(".")+"\\myText.txt");
sw.WriteLine("追逐理想");
sw.WriteLine("kzlll");
sw.WriteLine(".NET笔记");
sw.Flush();
sw.Close();
StreamWriter sw=File.AppendText(System.Windows.Forms.Application.StartupPath+"\\lgcx.log");
sw.WriteLine(SysLog.FProgramName+SysLog.FCreateName+SysLog.FTime+SysLog.FId+SysLog.FPath+SysLog.FDesc);
//sw.WriteLine("kzlll1");
//sw.WriteLine(".NET笔记1");
sw.Flush();
sw.Close();