Object of type 'A' cannot be converted to type 'A' with own Control.
-
Hello, I have here and than the following Problem: I have a self-made control in a library that I use in my application. After a while the designer tells me, when I want to open the Form containing the Control, that he cannot convert type 'A' to type 'A', where 'A' is a own class that contains Data that can be changed with the control. In the InitializeComponent() of the Form there is the call
this.theControl.TheA = ((A)(resources.GetObject("theControl.TheA")));
that I think causes the Problem. As with this the Data is serialized and deserialized, I believe that after changing the library that contains the control this serialize does not work in the same way (maybe the assembly version number is included?). Is there a way to take control over the storing of complex data to not have it serialized in the .resx file? Thanks for your help. Greets Roland
Hi! I'm a signature virus. Copy me into your sig file and help me spread!
-
Hello, I have here and than the following Problem: I have a self-made control in a library that I use in my application. After a while the designer tells me, when I want to open the Form containing the Control, that he cannot convert type 'A' to type 'A', where 'A' is a own class that contains Data that can be changed with the control. In the InitializeComponent() of the Form there is the call
this.theControl.TheA = ((A)(resources.GetObject("theControl.TheA")));
that I think causes the Problem. As with this the Data is serialized and deserialized, I believe that after changing the library that contains the control this serialize does not work in the same way (maybe the assembly version number is included?). Is there a way to take control over the storing of complex data to not have it serialized in the .resx file? Thanks for your help. Greets Roland
Hi! I'm a signature virus. Copy me into your sig file and help me spread!
You can change the way the designer serializes TheA property by putting the following attribute on TheA property: [DesignerSerializationVisibility(...)] Beyond that, if you want further control, you may need to have the control implement ISerializable and perform serialization that doesn't care about the version to get around this issue.
-
You can change the way the designer serializes TheA property by putting the following attribute on TheA property: [DesignerSerializationVisibility(...)] Beyond that, if you want further control, you may need to have the control implement ISerializable and perform serialization that doesn't care about the version to get around this issue.
Thank you very much! Greets Roland
Hi! I'm a signature virus. Copy me into your sig file and help me spread!