Click here to Skip to main content
14,691,047 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I'm new into C# and would like to know how I can Serialize and Deserialize dynamically generated controls in a c# UserControl.

If anyone could help me, i'll be very thankful.

Thank you !

What I have tried:

I have successfully done this in windows forms, however i am still unsure after looking around the internet for solutions for UserControls.
Updated 27-Mar-20 10:51am
Ralf Meier 27-Mar-20 16:11pm
I agree with the Solution from Phil.O - but a question :
When you have a Solution for the Form itself - why don't you do the same for the UserControl ? Both are Containers which hold Controls in it's ControlCollection ...

1 solution

You do not serialize the controls themselves, you just serialize the information needed to (re)build them.
Maciej Los 27-Mar-20 16:46pm
phil.o 27-Mar-20 19:57pm
Thanks Maciej :)
I'm not sure it is sufficient for OP, though; kind of lacking some concrete info here.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900