string filename = textBox1.Text.Trim();
string context = textBox2.Text.Trim();
FileInfo fi = new FileInfo("c:\\" + filename + ".txt");
StreamWriter sw = fi.AppendText();
sw.Write(context);
sw.Close();
sw.Dispose();
整理一下下面的代码看看:
FileInfo fi = new FileInfo("完全路径或相对路径" + this.textBox1.Text);
fi.AppendText(this.textBox2.Text);
textbox1存放文件名
textbox2存放内容