0

I have create a user setting in my Windows form application named "ExchangeRate" and set it to "1", then the value is being updated at runtime:

Properties.Settings.Default.ExchangeRate = 1.5;
Properties.Settings.Default.Save();

But when I restart the application the "ExchangeRate" value reset back to "1".

How can I fix this issue to load the value I previously set "1.5" in this case?

lchanmann
  • 357
  • 2
  • 10
  • Are you trying this in debug mode? Maybe it is overridden on every run? – Matthias Dec 31 '11 at 08:57
  • @MatthiasKoch: Yes I'm in debug mode, what can I do then? – lchanmann Dec 31 '11 at 09:03
  • @mann: I'm just guessing, but you can try to start the application through the explorer. – Matthias Dec 31 '11 at 09:05
  • @MatthiasKoch: It doesn't work. I also try [here](http://stackoverflow.com/questions/2201819/why-are-persisted-user-settings-not-loaded) but no luck :( – lchanmann Dec 31 '11 at 09:11
  • User settings are stored in %user%\AppData\Local afaik. Try to find the user.config. Maybe it is a permission problem. – Matthias Dec 31 '11 at 09:21
  • I'm not near VS so I can't test what I'm saying, but have you tried `Properties.Settings.ExchangeRate = 1.5; Properties.Settings.ExchangeRate.Save();`? I think you might not want to touch the `Default`, that would be to return to it's inicial value, created in design-time. Give it a go and I'll test it later as well. – Fernando Silva Dec 31 '11 at 13:47

1 Answers1

0

You have to synchronize your settings every time you change.

If you have changed a value just checked whether it has been changed in the app.config file which will be like your applicationname.exe.config

Kishore Kumar
  • 12,675
  • 27
  • 97
  • 154