PC Review


Reply
Thread Tools Rate Thread

ArgumentException when adding a form to a panel

 
 
=?Utf-8?B?UmVnaXMgRm9udGVz?=
Guest
Posts: n/a
 
      3rd May 2007
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()




 
Reply With Quote
 
 
 
 
=?Utf-8?B?UmVnaXMgRm9udGVz?=
Guest
Posts: n/a
 
      3rd May 2007
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:
>

(...)
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding panel to base Form? Cannot see controls. Doc John Microsoft C# .NET 3 16th Jul 2007 08:53 AM
ArgumentException when adding an XML signature =?Utf-8?B?SGFucw==?= Microsoft Dot NET Framework 0 3rd Apr 2006 11:54 AM
Re: ArgumentException when adding to this.Controls Daniel Moth Microsoft Dot NET Compact Framework 0 9th Sep 2005 09:20 PM
Manually adding usercontrol to panel on form tonny.steen@invenia.no Microsoft Dot NET Framework Forms 1 29th Jun 2005 03:09 PM
ArgumentException when adding a MenuItem INCA Hellas Ltd Microsoft Dot NET Compact Framework 1 18th Nov 2004 11:10 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:23 PM.