文章存档

using System.IO;

//写入
StreamWriter sw = new StreamWriter( @"C:\QBTXT.txt");
sw.WriteLine("----------------hello----------------");
sw.WriteLine("内容");
sw.WriteLine("----------------hello----------------");
sw.Flush();
sw.Close();

//读取
System.IO.StreamReader st;
st = new System.IO.StreamReader(@"C:\QBTXT.txt", System.Text.Encoding.UTF8);//UTF8为编码
this.textBox1.Text = st.ReadToEnd();

推荐(0)
收藏