471,853 Members | 824 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,853 software developers and data experts.

IDE failing to load Form2 when inheriting from Form1 containing user control

HELP PLEASE!! The C# Visual Studio IDE is failing to load an
inherited form into the IDE from a base form when I add items to an
array property of a user control on the base form. That sounds
confusing but let me explain:

I have a UserControl, let's call it "ButtonArrayControl", and also a
separate class for holding various properties:

[Serializable()]
public class MyButtonProperties
{
// Text to go on the button
string sText;
public string Text
{
set { sText=value; }
get {return sText; }
}
// Unique Key for the button
string sKey;
public string Key
{
set { sKey=value; }
get {return sKey; }
}
...etc...
}

The "ButtonArrayControl" defines an array of the above class called
"buttonLeftProperties" and a property named "ButtonLeft":

public MyButtonProperties[] buttonLeftProperties = new
MyButtonProperties[0];

...

public MyButtonProperties[] ButtonLeft
{
set
{
// Point to the modified array
this.buttonLeftProperties = value;
}
get { return this.buttonLeftProperties; }
}

All this appears to work ok and I can put the control on Form1 and add
lots of Text/Key data within the IDE to the "ButtonLeft" property. No
problem.

However if I now create a Form2 and inherit from Form1 I get the
following message when trying to load Form2 into the IDE:
"
An error occurred while loading the document. Fix the error, and then
try loading the document again. <SNIP>
An exception occurred while trying to create an instance of Form1.
The exception was "The type serialized in the .resources file was not
the same type that the .resources file said it contained. <snip>
"

and Form2 will not load !

If I remove all the Text/Key data from Form1, then Form2 loads fine,
but adding Text/Key data to Form1 stops Form2 from loading.

Please has anyone got any ideas what I am doing wrong?

Thank-you very much,
Hunter
Nov 15 '05 #1
0 1377

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by R. Harris | last post: by
2 posts views Thread by Pascal | last post: by
4 posts views Thread by Kimmo Laine | last post: by
NeoPa
reply views Thread by NeoPa | last post: by
reply views Thread by YellowAndGreen | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.