C# winform写入和读取TXT文件
1 2 3 4 5 6 7 8 9 10 11
| string str; str=this.textBox1.Text; StreamWriter sw = new StreamWriter(Application.StartupPath +"\\txtwriter.txt", false); sw.WriteLine(str); sw.Close();
string str; StreamReader sr = new StreamReader(Application.StartupPath +"\\txtreader.txt", false); str = sr.ReadLine().ToString(); sr.Close(); this.textBox1.Text = str;
|
转自:https://blog.csdn.net/lzid2008/article/details/53672244