1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| static void ShowConfig()
{
// For read access you do not need to call the OpenExeConfiguraton
foreach (string key in ConfigurationManager.AppSettings)
{
string value = ConfigurationManager.AppSettings[key];
MessageBox.Show("Key: " + key + " Value: " +value);
}
}
private void Parametre_fichiers_lot_Load(object sender, EventArgs e)
{
ShowConfig();
System.Configuration.Configuration config =ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
// Add an Application Setting.
config.AppSettings.Settings.Add("Modification Date",DateTime.Now.ToLongTimeString() + " ");
// Save the configuration file.
config.Save(ConfigurationSaveMode.Modified);
// Force a reload of a changed section.
ConfigurationManager.RefreshSection("appSettings");
ShowConfig(); |
Partager