Reputation: 3534
I have a TextBox in my .NET application that control various settings in my application. The values entered are likely remain the same on each execution of the app. I'd like the data to be retained so on the next launch of the application the values are already populated.
What's the best way to handle this? Write out the values to a file on ApplicationExit and then reread them on launch? There's got to be a more clever way...
Thanks.
Upvotes: 0
Views: 191
Reputation: 6348
It sounds like you want to save the form's state. If so, check out this question/answers.
How to auto save and auto load all properties in winforms C#?
Upvotes: 0
Reputation: 46008
Look at Using Your Application Settings Class with Your Application section in this document:
Persisting Application Settings in the .NET Framework
Upvotes: 2
Reputation: 29073
You could write them a to a file (including a 'settings' file), a database, the registry, or some remote webservice. Either way, the pattern is pretty much the same. You aren't missing out on a secret handshake that makes WinForms do this automatically :)
Upvotes: 0