c# winfrom程序 有一个按钮id=a 点击他 就以文本文档的方式打开相同目录的一个app.xml文件 可以手动编辑后 保存
放一个文本框textBox1,设置MultiLines = true:
读取
textBox1.Text = System.IO.File.ReadAllText("c:\\路径\\xxx.xml");
保存
System.IO.File.WriteAllText("c:\\路径\\xxx.xml", textBox1.Text)
读取
System.IO.StreamReader reader = new System.IO.StreamReader("e:\\bom.xml");
richTextBox1.Text = reader.ReadToEnd();
保存,可以用stremwriter
如果是exe相同路径下的xml
System.AppDomain.CurrentDomain.BaseDirectory + "\\xxx.xml"
我的代码是这么写的