Windows Develop Bookmark and Share   
 index > Windows Forms General > Show user control in Splitcontainer panel
 

Show user control in Splitcontainer panel

Hello,


I have Form1 that has a splitContainer and a user control called Application that is a panel with textfields.
When the users clicks on a button in splitContainer1 i want Application to appear Dock.Fill in splitContainer2.

Can someone help me?

Thank you in advance.
dealwi8me  Tuesday, September 15, 2009 11:40 AM
void button1_Clicked(object sender, EventArgs e)
{
splitContainer1.Panel2.Controls.Clear(); // remove all controls from Panel2
Application app = new Application();
app.Fill = DockStyle.Fill;
splitContainer1.Panel2.Controls.Add(app);
}
void button2_Clicked(object sender, EventArgs e)
{
splitContainer1.Panel2.Controls.Clear(); // remove all controls from Panel2
TabControltabby = new TabControl();
tabby.Fill = DockStyle.Fill;
splitContainer1.Panel2.Controls.Add(tabby);
}
  • Marked As Answer bydealwi8me Friday, September 18, 2009 9:10 AM
  •  
Tergiver  Wednesday, September 16, 2009 9:16 PM
void button1_Clicked(object sender, EventArgs e)
{
Application app = new Application();
app.Fill = DockStyle.Fill;
splitContainer1.Panel2.Controls.Add(app);
}

p.s. I recommend not naming your user control Application as that conflics with System.Windows.Forms.Application.
Tergiver  Tuesday, September 15, 2009 3:02 PM
Thank you that works but i have a problem.
After button1 is clicked and app is been shown at panel, if i click on button2 which loads a tabcontrol in panel2 how can i close app or make it invisible?

dealwi8me  Wednesday, September 16, 2009 2:55 PM
void button1_Clicked(object sender, EventArgs e)
{
splitContainer1.Panel2.Controls.Clear(); // remove all controls from Panel2
Application app = new Application();
app.Fill = DockStyle.Fill;
splitContainer1.Panel2.Controls.Add(app);
}
void button2_Clicked(object sender, EventArgs e)
{
splitContainer1.Panel2.Controls.Clear(); // remove all controls from Panel2
TabControltabby = new TabControl();
tabby.Fill = DockStyle.Fill;
splitContainer1.Panel2.Controls.Add(tabby);
}
  • Marked As Answer bydealwi8me Friday, September 18, 2009 9:10 AM
  •  
Tergiver  Wednesday, September 16, 2009 9:16 PM
Thank you that works.
dealwi8me  Friday, September 18, 2009 9:06 AM

You can use google to search for other answers

Custom Search

More Threads

• TextBox Event Question
• justify numeric value
• Passing a parameter from one form to another form.
• ContextMenuStrip Source
• BackgroundWorker and Shared Memory... How?
• WebBrowser instance in the 'Internet Zone' in IE?
• Combo box value is not displaying after selection
• Use of application blocks?
• Group Box and Panel Secrets Wanted
• Checkboxes that work similar to radio buttons????