HOWTO serialize a form and all its controls

Hello gurus,
I need to serialize a form and all controls that the user placed into. The problem is that the ControlCollection object is marked as not serialized. how i can solve this issue?.
Regards
[215 byte] By [CFQüeb] at [2008-2-7]
# 1
You'll find that there are many other objects that are not serializable when trying to do this, ControlCollection is just one of them, Control is another.

Here's a brief description of some of what I did in order to serialize a control tree:

- write a custom formatter in order to overcome several shortcomings of the serialization model(s) and nonserializable objects (events in particular).
- write serialization surrogates for all derivations of Control you are using
- write a surrogate for ControlCollection that also registers with the custom formatter to receive an "EndDeserialization" event so that it may insert the desrialized controls back into the control tree AFTER all the controls are deserialized.
- implement ISerializable on all custom controls which in turn calls the surrogates in order to serialize base classes.

Again, this is the 10,000 ft view of what needs to be done. The devil is in the details. This turns out to be a fairly large task to accomplish but you will learn a lot about serialization ;-)

- Ray

RayManning at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Remoting and Runtime Serialization...
# 2
Thank You for your reply Ray,
But..., like you see, the seralization is "new" for me. Could you send me a example or a URL with more information about?.
Regards
CFQüeb at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Remoting and Runtime Serialization...
# 3
You might start with the implementation that Joannes is working on: http://cvs.sourceforge.net/viewcvs.py/ngrid/NGrid/Core/PartialFormatter.cs

- Ray

RayManning at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Remoting and Runtime Serialization...

.NET Development

Site Classified