469,903 Members | 1,791 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,903 developers. It's quick & easy.

Best practice for embedding forms

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


Mar 23 '06 #1
2 1265
Hi Baliga,

User Controls can be "embedded" on the parent form. Take a look in the
docs:
http://msdn.microsoft.com/library/de...classtopic.asp


--
Ward Bekker
"Asp.Net Discussions for the Professional Developer"
http://www.dotnettaxi.com

"Free .Net 2.0 C# to/from VB.Net Code Converter"
http://www.dotnettaxi.com/Tools/Converter.aspx
Mar 23 '06 #2
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

"Ward Bekker" <wa**@NospaaMequanimity.nl> wrote in message
news:dv**********@news.cistron.nl...
Hi Baliga,

User Controls can be "embedded" on the parent form. Take a look in the
docs:
http://msdn.microsoft.com/library/de...classtopic.asp


--
Ward Bekker
"Asp.Net Discussions for the Professional Developer"
http://www.dotnettaxi.com

"Free .Net 2.0 C# to/from VB.Net Code Converter"
http://www.dotnettaxi.com/Tools/Converter.aspx

Mar 23 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by David | last post: by
10 posts views Thread by Picho | last post: by
136 posts views Thread by Matt Kruse | last post: by
2 posts views Thread by digitalQ | last post: by
4 posts views Thread by Ned Balzer | last post: by
reply views Thread by Budhi Saputra Prasetya | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.