标签:manage cat text event ble 保存 str ext .sh
一、C#读取Appconfig内容
private void button1_Click(object sender, EventArgs e)
{
string fileName=System.IO.Path.GetFileName(Application.ExecutablePath);
Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(fileName);
string value = config.AppSettings.Settings["ip"].Value = txtIP.Text;
string value1 = config.AppSettings.Settings["username"].Value = txtUserName.Text;
string value2 = config.AppSettings.Settings["userpwd"].Value = txtPassword.Text;
config.Save();
MessageBox.Show("保存成功!");
}
二、修改Appconfig
private void ServerSetting_Load(object sender, EventArgs e)
{
string fileName = System.IO.Path.GetFileName(Application.ExecutablePath);
Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(fileName);
string ip = config.AppSettings.Settings["ip"].Value;
string username = config.AppSettings.Settings["username"].Value ;
string userpwd = config.AppSettings.Settings["userpwd"].Value ;
txtIP.Text = ip;
txtUserName.Text = username;
txtPassword.Text = userpwd;
}
标签:manage cat text event ble 保存 str ext .sh
原文地址:http://www.cnblogs.com/lpfblog/p/6692911.html