Search code examples
c#.netdata-bindingcontrolsapplication-settings

Do you have to call .Save() when modifying a application setting that is bound to a control property?


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?


Solution

  • 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.