Click here to Skip to main content
15,889,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have panel with multiple panel and controls in it(Kind Of Document Creating).
I want to store Main Panel's state with inner panel and controls location and values as a template and load it again too.

#NewToCodeProject

Thank You

What I have tried:

I've tried serialization of main panel to xml but it did not work.
Posted
Updated 12-Sep-18 14:14pm

1 solution

Forms and Controls are not serializable. You have to create your own serialization scheme from scratch. This means creating a data structure to hold all of the information you want to keep track of, such as the type names of the controls you want to save, and all the data required to recreate the controls and their locations.

You can then serialize the data structure to a file.

When you deserialize the file, you'll have to use the information to create all of the controls and set the appropriate properties, like Top, Left, Width, Height, Text, ... or whatever you're using.

If you save save a piece of information yourself, there is nothing that's going to do it for you.

Search results for "C# custom serialization[^]".
 
Share this answer
 

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