In Delphi it's possible to make a form appear inside a panel control as a
child subform by setting the form's Parent property to the instance of the
control. When I try to do the same in .NET I get the error "Cannot make a
top-level control a child of another control". It would really be a huge
disappointment to find out that Windows Forms doesn't allow nesting of forms
inside panel controls, so I hope I'm just not doing it right.

Any suggestions?

Re: Making a form a child of a control by Tim

Tim
Wed Jul 14 09:34:20 CDT 2004

Never mind, just found the answer:

myForm.TopLevel = false;
myForm.FormBorderStyle = FormBorderStyle.None;
panel1.Controls.Add( myForm ); // or myForm.Parent = panel1;

Funny that setting TopLevel to false at design time didn't seem to do the
trick. It HAD to be set at runtime for the Parent assignment to work!


"Tim A." <taskerov@cpumanagement.KILL-ALL-SPAMMERS.com> wrote in message
news:WPudneO8_KYt32jdRVn-jg@golden.net...
> In Delphi it's possible to make a form appear inside a panel control as a
> child subform by setting the form's Parent property to the instance of the
> control. When I try to do the same in .NET I get the error "Cannot make a
> top-level control a child of another control". It would really be a huge
> disappointment to find out that Windows Forms doesn't allow nesting of
forms
> inside panel controls, so I hope I'm just not doing it right.
>
> Any suggestions?
>
>



Re: Making a form a child of a control by Oriol

Oriol
Wed Jul 14 11:26:29 CDT 2004

Does anybody knows how to close a, TopLevel=False and child from another
control, form.

I open a from using the lines below but I cannot close it after.

Thanks.

"Tim A." <taskerov@cpumanagement.KILL-ALL-SPAMMERS.com> escribió en el
mensaje news:paidnTcvbP_w2WjdRVn-jw@golden.net...
> Never mind, just found the answer:
>
> myForm.TopLevel = false;
> myForm.FormBorderStyle = FormBorderStyle.None;
> panel1.Controls.Add( myForm ); // or myForm.Parent = panel1;
>
> Funny that setting TopLevel to false at design time didn't seem to do the
> trick. It HAD to be set at runtime for the Parent assignment to work!
>
>
> "Tim A." <taskerov@cpumanagement.KILL-ALL-SPAMMERS.com> wrote in message
> news:WPudneO8_KYt32jdRVn-jg@golden.net...
> > In Delphi it's possible to make a form appear inside a panel control as
a
> > child subform by setting the form's Parent property to the instance of
the
> > control. When I try to do the same in .NET I get the error "Cannot make
a
> > top-level control a child of another control". It would really be a
huge
> > disappointment to find out that Windows Forms doesn't allow nesting of
> forms
> > inside panel controls, so I hope I'm just not doing it right.
> >
> > Any suggestions?
> >
> >
>
>



Re: Making a form a child of a control by hirf-spam-me-here

hirf-spam-me-here
Wed Jul 14 11:41:49 CDT 2004

* "Oriol" <intranet[arroba]rvsa-itv.com> scripsit:
> Does anybody knows how to close a, TopLevel=False and child from another
> control, form.
>
> I open a from using the lines below but I cannot close it after.

Remove it from the container's 'Controls' collection and call its
'Close' method.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>