winform修改配置文件并保存,读取!
2013-01-10 09:16
225 查看
1、增加引用-->System.Configuration。
2、引用命名空间-->using System.Configuration。
3、代码:
4、重启应用程序以应用配置:
2、引用命名空间-->using System.Configuration。
3、代码:
//打开 Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); //修改配置文件 config.AppSettings.Settings["test"].Value = textBox1.Text; //保存 config.Save(); //读取 textBox2.Text = System.Configuration.ConfigurationSettings.AppSettings["test"].ToString();
4、重启应用程序以应用配置:
if (MessageBox.Show("Restart the program to apply the new configuration!", "Reminder", MessageBoxButtons.OK) == DialogResult.OK) { Application.Restart(); }
相关文章推荐
- Winform 修改并保存配置文件
- java 4种方式读取配置文件 + 修改配置文件
- C# 配置文件读取与修改
- C# 配置文件读取与修改
- 保存和读取ini配置文件
- C# 读取保存App.config配置文件的完整源码参考(转)
- c#配置文件appStrings配置节的读取、添加和修改
- WinForm 读取配置文件(app.ini)
- 读取ini配置文件时,成员变量的内存数据被隐式修改了
- winform中修改配置文件 同理可以是xml等其他
- winform 创建文件,把值写入文件,读取文件里的值,修改文件的值,对文件的创建
- quick-x之android 下保存与读取配置文件
- java 4种方式读取配置文件 + 修改配置文件
- INI的替代品--XML配置文件读取与保存
- winform程序读取和改写配置文件App.config元素的值
- C#读取,修改并保存html文件——实例
- C# 配置文件读取与修改
- QT如何从配置文件读取参数并保存最近使用的参数
- Linux c 配置文件读取与修改
- winform程序读取和改写配置文件App.config元素的值