Hi,
There *might* be a more re-usable solution to your problem in the form of
Reflection.
You could use Reflection to identify all Read/Write properties on the form
in question (which would exclude Handle, along with a few others) and then
add them to a Dictionary object which you can then serialize. Simply
reverse the process for deserialization.
Don't forget though that things like the titlebar text will be serialized as
well - if you're using that for any kind of status indication, it may be a
gotcha. Also, if further down the line you opt to change the background
colour of your form, any saved data from the past will cause it to revert to
what it was before!
The above solution would only work for the form itself. If you wanted to do
it for everything on the form, you're looking at recursively drilling down
through each control contained within the form, and their controls, and so
on. Then you have to come up with a structured naming convention (like
"MyForm/MainPanel/OptionFrame/Panel3/ControlName.Text").
It really does start to get a bit ugly after a while, but depending on the
situation it could work out better for you than manually going through all
the properties you want. The danger is when you realise you only want to
store about a quarter of the form's read/write properties in the first
place, and that's when it might be a good idea to just bite the bullet and
do it yourself.
Cheers,
Alex Clark