读取文本
时间:2010-09-02 来源:其实你不懂
using System.IO;
using System.Text;
添加命名空间---------------------------------------------------------------------------
//读
string path = System.Windows.Forms.Application.StartupPath + "\\AboutUs.txt";
System.IO.StreamReader reader = new System.IO.StreamReader(path,
System.Text.Encoding.Default);
this.txtAboutUs.Text = reader.ReadToEnd();
reader.Close();
//写
string path1 = System.Windows.Forms.Application.StartupPath + "\\pp.txt";
//System.IO.StreamWriter writer = new System.IO.StreamWriter(path1, true);
System.IO.StreamWriter writer = new System.IO.StreamWriter(path1, false);
writer.Write(this.txtAboutUs.Text);
writer.Close();