Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to save state of checkbox, textbox and ... after closing a program in c#

In my C# program that is made with Visual Studio 2010 and uses WinForms, I would like the program to save state of some checkboxes and textboxes so the next time program will be loaded they are checked or unchecked as theire last run's state. Also same with strings inside textboxes and etc...

What will be the proper way to achieve this? Is there a built in stuff in .NET? Any tips and code snippets would be appriciated!

Thanks

like image 793
Saeid Yazdani Avatar asked Apr 20 '11 14:04

Saeid Yazdani


1 Answers

You'd probably want to look at reading the relevant values from your UI during the FormClosing event, and then saving them into User Settings.

Have a look at: http://codehill.com/2009/01/saving-user-and-application-settings-in-winforms/

like image 87
Adam Rackis Avatar answered Oct 12 '22 17:10

Adam Rackis