I am programming in .NET
I have an application setting of type string.
On my form I have a textbox. I bound the text property of the textbox to my application setting. If I type something in the textbox it changes the value that is held in the Application setting but the next time I start the program it goes back to the default value. Do I need to call Properties.Settings.Default.Save();
after the text is entered for the new value to be saved? Shouldn't it do this automatically? Is there a way I can make it do it automatically?
views:
59answers:
3
+3
A:
Yes, you need to call Save
explicitly. The binding changes the setting value in memory, but doesn't save the file
Thomas Levesque
2010-03-26 13:07:51
+2
A:
If you want it to be saved automatically, bind a handler to the TextChanged event and call Save() in it. It's just a double click and typing one line of code.
Greg Graham
2010-03-26 13:14:59
+1
A:
It is common practice to call Properties.Settings.Default.Save();
when close the application (for example, in FormClosing
event).
Zenya
2010-03-26 13:28:55