G
Guest
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()
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()