SunnyD
Belgian Waffler
I'm by no means an expert with .Net, so I'm trying to figure out all the nice tricks and such. One thing that I'm curious about is how to "nest" forms inside of other forms. Basically, imagine a UI where you have several "pages" that are discrete, and you want to use one form as a host container, but not in the MDI manner. In essence, I want discrete pages/UI's for each "panel".
I started playing around and found I couldn't make a form, do the following:
That causes an exception saying that FormX is a top-level container. So then I did this:
This works fine, but I find nearly no documentation on the TopLevel property, and no examples on how to do this anywhere - which leads me to believe this either isn't good practice or there's a different way it's done, or more likely I just don't understand Windows Forms enough. Is there a different (or better) way this is supposed to be done?
I started playing around and found I couldn't make a form, do the following:
FormX fm = new FormX();
fm.Parent = Form1.panel1;
fm.Show();
That causes an exception saying that FormX is a top-level container. So then I did this:
FormX gm = new FormX();
fm.TopLevel = false;
fm.Parent = Form1.panel1;
fm.Show();
This works fine, but I find nearly no documentation on the TopLevel property, and no examples on how to do this anywhere - which leads me to believe this either isn't good practice or there's a different way it's done, or more likely I just don't understand Windows Forms enough. Is there a different (or better) way this is supposed to be done?