提交留言板内容

来源:百度知道 编辑:UC知道 时间:2024/06/21 09:29:24
制作一个留言板程序,可将在文本框中输入的文字通过单击“提交”按钮,保存在指定的TXT文本文件中。代码怎么写?

C#实现法
string content = this.textBox1.Text;
string lj="C:\......."
FileStream fs = new FileStream(lj, FileMode.Create);
StreamWriter sw = new StreamWriter(fs);

sw.Write(content);
sw.Close();
fs.Close();
//lj为路径(LuJing) FileMode.Create为文件保存
//textBox1是你那个textbox的名字
记得在开头引入using System.IO;