Best practice for embedding forms

B

Baliga, Narasimha

Hi,



I am trying to write an app which will have say a MainForm that has a
TreeView and a Panel control on it. The project also has 2 other forms.



Now the TreeView would have 2 nodes and on each node click one of the 2
forms will be created (if not created before) and is shown embedded in the
main form inside the panel.



So I have code like this



if (frmScheduler == null)

{

frmScheduler = new SchedulerFrm();

//frmScheduler.Owner = this;

frmScheduler.FormBorderStyle = FormBorderStyle.None;

}

frmScheduler.TopLevel = false;

frmScheduler.Parent = panelControl1;

frmScheduler.Show();

My question is that would this be the best way of acheiving it? The above
code is for say Form1, I will have similar code for Form2. Object pointer
variable that holds the form object would be defined under the MainFrm. I
need to hide the form1 when Form2 is being shown.

regards

Baliga
 
B

Baliga, Narasimha

Hi Bekker,

Yeah I like the User Controls - they seem like a better approach as I can
then re-use them in any form. I will go ahead with this implementation as of
now.

regards
Baliga
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top