0

Whenever we update some user setting by calling the following code (Here the property name is given as 'SomeProperty').The following code runs on a button click eventHandler.

Settings.Default.SomeProperty = TextBox1.Text;

And save it by calling the save method like the following code

Settings.Default.Save();

[N.B: I am not leaving the TextBox1 empty, (i.e. initially I had initialized, SomeProperty's value as 'simple' and type as 'String' and obviously UserScope) And before I click the saving button I am writing 'Complex'- in TextBox1]

The value of 'SomeProperty' is changed, and I can see it as I load that value in a label in next run of the application. But when I try to manually find the updated value of 'SomeProperty' from the 'app.config' or 'app.exe.config' file I find that the value assigned to 'SomeProperty' while creating it is there(Not updated).

Can anyone please tell me where is the updated version of the .config file is saved?

What I have tried: I have no idea about why this is happening, and what is the remedy..

Izqry
  • 43
  • 6

1 Answers1

0

According to the documentation:

Settings that are application-scoped are read-only, and can only be changed at design time or by altering the .config file in between application sessions. Settings that are user-scoped, however, can be written at run time just as you would change any property value. The new value persists for the duration of the application session. You can persist the changes to the settings between application sessions by calling the Save method.

Mahdi
  • 3,199
  • 2
  • 25
  • 35
  • I have added some extra information describing my condition, please try to figure out why I am not seeing the updated value in app.config file?? – Izqry Mar 15 '17 at 05:52
  • 1
    Then take a look at this answer: http://stackoverflow.com/questions/1804302/where-is-the-data-for-properties-settings-default-saved – Mahdi Mar 15 '17 at 09:02
  • Thank you very much @Mahdi, this us exactly what I was searching. But unfortunately could not find this question before I asked this question. :) – Izqry Mar 15 '17 at 18:40