473,385 Members | 2,014 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,385 software developers and data experts.

ArgumentException when adding a form to a panel

Hi,

I have the following code, that worked OK with Visual Studio 2003:

Form2 v_Frm2 = new Form2();
m_pnlForms.Controls.Add(v_Frm2);
v_Frm2.Show();
v_Frm2.BringToFront();

It makes Form2 to appear inside a panel inside Form1. However, this same
code when running in Visual Studio 2005 (.net cf 2.0) gives the exception
described bellow. Does anyone know what is wrong, or how should I change my
code?

System.ArgumentException was unhandled
Message="Value does not fall within the expected range."
StackTrace:
at Microsoft.AGL.Common.MISC.HandleAr()
at System.Windows.Forms.Control._SetParent()
at System.Windows.Forms.Control.set_Parent()
at ControlCollection.Add()
at NestedForms.Form1.Form1_Load()
at System.Windows.Forms.Form.OnLoad()
at System.Windows.Forms.Form._SetVisibleNotify()
at System.Windows.Forms.Control.set_Visible()
at System.Windows.Forms.Application.Run()
at NestedForms.Program.Main()


May 3 '07 #1
1 3268
Just to emphasize: We are dealing with *COMPACT* framework here...

"Regis Fontes" wrote:
Hi,

I have the following code, that worked OK with Visual Studio 2003:
(...)
May 3 '07 #2

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

Similar topics

0
by: yurps | last post by:
Hello here is my html, if you click the missing image in the first column on the left, the div is shown, when clicked again the div disappears...but the bottom border disappears as well...Is there...
4
by: Kerry Sanders | last post by:
I was playing around with a new Windows form yesterday. I wanted to drop two panels on the form. The first would be set Dock=Top. The second would be set Dock=Fill. So, I dropped the first...
2
by: Richard Muller | last post by:
Hi All, I'm running MSDE 2002, ver. 7.0.9466 with Net Framework 1.0, ver. 1.0.3705 over Win2000ProSP4. I created a new Visual C# project using the Windows Application template. I'm trying...
1
by: Terry | last post by:
I've seen several posts from people who have seen this flashing in TreeView's when resizing a form. I've noticed it in my app, but only in the child windows. For example, my main form has a...
2
by: Nony Buz | last post by:
My objective is simply: Notify a form when a image file has been created in a directory. First there is a basic interface for the callback function: public interface INewImageNotify { void...
5
by: Jeremy Ames | last post by:
I have run into a major road block with my page development projects. I am trying to add a literal control to my asp.net page and I got an error stating that the control could not be added because...
4
by: hula | last post by:
Hello i have a problem with adding usercontrols to a panel. I use a panel to add up to 20 usercontrols to a panel that has autoscrol enabled. The number of usercontrols to add, and the data...
0
by: pianobasher | last post by:
Hello I have a class that's derived from a normal windows Form. I call it BaseContainer. It has a Panel and a built-in method to add another BaseContainer derivative inside that panel. I hoped...
0
by: arbe81 | last post by:
I have a problem with ScrollControlIntoView() in .NET 2.0: I have a UserControl that holds a Panel which is set to AutoScroll. To this panel, I add a list of Controls so the panel needs to scroll....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.