473,387 Members | 3,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 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 1465

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: ptass | last post by:
I have a main form (Form1) which opens a second form (Form2) when a button is clicked. Form2 has .FormBorderStyle set to FixedSingle. Form2 contains two buttons, one which unpins it from Form1...
0
by: dlieu | last post by:
I've found an odd situation in where the Load event of the active form fires (after the Unload event) when Access is closed. I am able to reproduce this situation in Access 2002 SP3 and Access 2003...
5
by: PAPutzback | last post by:
Form2 has one purpose to open and list some names and ids. I want to handle the list box click event on form2 so I can get the selected value onto a field in form1. I changed this Dim MyForm2...
3
by: Mateusz Rajca | last post by:
Hello, I have Form1 - the main form with some controls including a button. I have Form2 - the properties form with a combobox and button. The user can select the colors of a button in the...
3
by: R. Harris | last post by:
Hi. I have 2 forms: form1 form2 On Form2 I have a listbox and a button. When I click the button it calls a function from form1 and within that function it updates the listbox on form2. My...
2
by: Pascal | last post by:
bonjour/hello I have an application with several forms : form1 is loaded at first. Man makes some staff (filling text box, clicking radiobutton) in this window and then click nextbutton and so on...
9
by: RvGrah | last post by:
I'm completely new to using background threading, though I have downloaded and run through several samples and understood how they worked. My question is: I have an app whose primary form...
4
by: Kimmo Laine | last post by:
Hi! Is there a way to generate Load-event for form without showing it? My problem is that if i try to set control states before Load is raised, control states may or may not work. Here is some...
5
by: lukasmazur | last post by:
Hi I have a problem with using listBox1. I have a two forms form1 and form2. In form1 are controls listBox1, textBox1 and button witch creating object of class Form2. In class Form2 I create a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.