public string ReadConfig() { List<string> list = new List<string>(); ExeConfigurationFileMap file = new ExeConfigurationFileMap(); file.ExeConfigFilename = System.Windows.Forms.Application.ExecutablePath + ".config"; Configuration config = System.Configuration.ConfigurationManager.OpenMappedExeConfiguration(file, ConfigurationUserLevel.None); var myApp = (AppSettingsSection)config.GetSection("appSettings"); return myApp.Settings["lcc"].Value; } public string WriteConfig(string val) { ExeConfigurationFileMap file = new ExeConfigurationFileMap(); file.ExeConfigFilename = System.Windows.Forms.Application.ExecutablePath + ".config"; Configuration config = System.Configuration.ConfigurationManager.OpenMappedExeConfiguration(file, ConfigurationUserLevel.None); var myApp = (AppSettingsSection)config.GetSection("appSettings"); myApp.Settings["lcc"].Value = val; config.Save(); return val; }