469,644 Members | 1,955 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,644 developers. It's quick & easy.

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:

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; }

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

public MyButtonProperties[] buttonLeftProperties = new


public MyButtonProperties[] ButtonLeft
// 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

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,
Nov 15 '05 #1
0 1321

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
By using this site, you agree to our Privacy Policy and Terms of Use.