Hello.
Can I serialize a UserControl directly? By that I mean the entire control itself, not by using extra inner classes or specific logic for each usercontrol? I have 50ish usercontrols which I have made, and implementing logic for serialization into each is very time-consuming.
I've tried to serialize the usercontrols, but got the following exception:
System.Runtime. Serialization.S erializationExc eption: The type System.Windows. Forms.UserContr ol in Assembly System.Windows. Forms, Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9 is not marked as serializable.
More specific explanation:
I have a form with a combobox containing a list of my usercontrols. When I choose a usercontrol, it is added to the form and then removed again when another one is chosen, hence there's always only one of the controls added to my form. When I've chosen a usercontrol I would like to restore the values I've entered it previously. All my usercontrols inherit from "MainUserContro l" which inherit from Forms.UserContr ol.
Hope I've explained my problem properly.
Regards,
Øyvind
Can I serialize a UserControl directly? By that I mean the entire control itself, not by using extra inner classes or specific logic for each usercontrol? I have 50ish usercontrols which I have made, and implementing logic for serialization into each is very time-consuming.
I've tried to serialize the usercontrols, but got the following exception:
System.Runtime. Serialization.S erializationExc eption: The type System.Windows. Forms.UserContr ol in Assembly System.Windows. Forms, Version=1.0.500 0.0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9 is not marked as serializable.
More specific explanation:
I have a form with a combobox containing a list of my usercontrols. When I choose a usercontrol, it is added to the form and then removed again when another one is chosen, hence there's always only one of the controls added to my form. When I've chosen a usercontrol I would like to restore the values I've entered it previously. All my usercontrols inherit from "MainUserContro l" which inherit from Forms.UserContr ol.
Hope I've explained my problem properly.
Regards,
Øyvind
Comment