Question : write into an app.config

Hi!

I've a winform application that have to store some Ids into the app.config.

I found this:
http://www.codeproject.com/KB/cs/SystemConfiguration.aspx

But my configuration file doesn't change.

What I've done wrong?
1:
2:
3:
4:
5:
6:
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
            config.AppSettings.Settings.Remove(FAVORITE_CONFIG_FIELD);//FAVORITE_CONFIG_FIELD is a const that contains the correct field in the config file
            config.AppSettings.Settings.Add(FAVORITE_CONFIG_FIELD, sb.ToString());//I've checked, sb.ToString() gives a different value than the actual
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSettings");
//my app.config doesn't have change

Answer : write into an app.config

I modified
config.Save(ConfigurationSaveMode.Modified);

to
config.Save(ConfigurationSaveMode.Full);
And it works
Random Solutions  
 
programming4us programming4us