473,699 Members | 2,768 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 "ButtonArrayCon trol", and also a
separate class for holding various properties:

[Serializable()]
public class MyButtonPropert ies
{
// 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 "ButtonArrayCon trol" defines an array of the above class called
"buttonLeftProp erties" and a property named "ButtonLeft ":

public MyButtonPropert ies[] buttonLeftPrope rties = new
MyButtonPropert ies[0];

...

public MyButtonPropert ies[] ButtonLeft
{
set
{
// Point to the modified array
this.buttonLeft Properties = value;
}
get { return this.buttonLeft Properties; }
}

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 1478

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

Similar topics

0
1315
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 by setting ..ShowInTaskBar to true, and setting .Owner to false. The other buttons click event reverses, this by setting .Owner to the form1 instance, and .ShowIntTaskBar to false. This all works fine, with Form2appearing in the taskbar and...
0
2452
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 on computers running WinXP. This does not appear to happen in Access 2000 on a computer with Win2000. This only seems to happen if there is a hidden form also loaded and, so far, I'm only able to reproduce this if the forms are loaded through...
5
1849
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 As New PHfx.Form2 to With Events MyForm2 As New PHfx.Form2 and tried adding an event handler but intellisense will not show form2s objects, just the methods.
3
2490
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 combobox in Form2 and press "OK". What code should I add to "OK" so that the user can change the colors of a button in Form1? Mateusz
3
2476
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 problem is I don't see the items added to the listbox unless I use
2
2245
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 from form to form. I use theese commands to pass from Form1 to Form2 : Form2.Activate() Me.Hide() Form2.Show()
9
18023
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 will almost always lead to the user opening a certain child window that's fairly resource intensive to load. Is it possible to load this form in a backgroundworker and then use the Show method and hide method as necessary? Anyone know of
4
1668
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 code: Lets say that i have 2 form - form1 and form2. In form1 i have a button. When this button is pressed i will display the other form:
5
2520
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 pointer to object of class Form1. I don't known how to use method add(), where can I find it. From Form1 I can add value like this this->listBox1- I cant find it. I have textBox1 on Form1 and I can change text in this control like this ...
0
8615
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8911
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7748
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6533
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5872
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4627
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3057
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2345
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2009
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.