其实你不懂

导航

读取文本

 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();

posted on 2010-09-02 09:09  其实你不懂  阅读(221)  评论(0)    收藏  举报