C# winform写入和读取TXT文件

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;///读取

相关文章:

  • 2021-12-04
  • 2021-12-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-02
  • 2022-12-23
猜你喜欢
  • 2021-10-05
  • 2022-02-24
  • 2022-12-23
  • 2022-01-08
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案