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

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Kitchen Bin (kitchenbin_at_hotmail.com)
Date: 02/25/04


Date: 24 Feb 2004 21:46:40 -0800

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



Relevant Pages

  • windows form close and open next form
    ... Just i want to close the form1 when i click the button1 on form1 and ... the same time i want to load the form2 on the same event. ...
    (microsoft.public.dotnet.languages.csharp)
  • Form close
    ... Just i want to close the form1 when i click the button1 on form1 and ... the same time i want to load the form2 on the same event. ...
    (microsoft.public.dotnet.general)
  • How to pass objects between forms?
    ... When i load Form1, i load this form and instantiate Object1 and ... On a button on Form1, i want to load Form2 and on it is a listbox that ... Now if i pass these objects in the constructor to Form2, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: A7N8X (Deluxe) Madness
    ... I thought I would share some of my experiences with the ASUS A7N8X. ... perfectly stable and I see no performance hit with the IDE disks. ... This is clearly connected to high IDE load, ... > locks up with a 100% chance while doing an fsck. ...
    (Linux-Kernel)
  • Re: How to display progress on slow opening form.
    ... I would use the 'form with load message' to open form2. ... Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia ...
    (microsoft.public.access.forms)