
The obvious way to do this would be to serialise the form object to disk. I was recently working on an application where a database wasn't really practical, but I wanted to save a form's data for next time. Every time you change the form, you have to change the code to save the data. Apart from the amount of time it can take to code all of this, maintaining it can be a nightmare, especially if there are a lot of controls on the form. Reopening the form involves reading the data back from the database, and populating all the form's controls with the data. In many applications nowadays, this is done with a database.

It's a fairly common requirement to want to save the data when a user closes a form. Download the FormSerialisor.cs class file - 2.08 KB.
