Can I add a Form into a Panel?

  • Thread starter Thread starter Galaxia
  • Start date Start date
G

Galaxia

I am trying to add a Form into a Panel in .NET 2003:

Form2 ff2 = new Form2();
panel2.Controls.Add(ff2);

But it failed in runtime which said I could not add a top control into another control.
Can I have any way to add a Form into a Panel? Need I modify any property of the Form to make it not a "top control"?

--
"Forward Galaxia"
 
Galaxia said:
I am trying to add a Form into a Panel in .NET 2003:

Form2 ff2 = new Form2();
panel2.Controls.Add(ff2);

But it failed in runtime which said I could not add a top control into
another control.
Can I have any way to add a Form into a Panel? Need I modify any property
of the Form to make it not a "top control"?

\\\
Dim f As New Form2()
f.TopLevel = False
Me.Panel1.Controls.Add(f)
f.Show()
///

Notice that this may cause focus problems, creating a usercontrol is the
preferred way.
 
Back
Top