-
Form container
Hi all,
I have to design a form such that, it will contain a list of buttons or toolbar on the left side. Each time the user clicks on one of the buttons, it will load the corresponding sub/child form on the right side of the main form. Note that Mdi shold not be used. Now what I need is to know if its possible to make other forms appear inside a classic form in VB.Net. If so then how, should I place the forms in a container control. All help appreciated. thanx.
-
Do you have to use forms?
Can't you use Panel controls instead?
-
I did something similar with a treeview on the left and a tab control that would load the appropriate tabs for the treeview item selected. Then when the user clicked on a tab, I would actually go and load the tab page content.
-
Hi
Put two panels on your main form. The panel on left will hold your menup buttons (pnlButton) and the one on the right will act as container for your forms (pnlForm). When you click on a button instantiate the corresponding form and change its container property to that of the pnlForm panel. Your forms should be window less.
-
Thanx Mr.No, but isn't the Container property of a form Read Only?
-
You're right, didn't know that. I think you should look for a property or method in the Panel control or any other container control that allows you to drop controls on them so that you could add your instantiated form into it.
-
At last...
private void button1_Click(object sender, System.EventArgs e)
{
Form frm = new frm_Tasks(); //Create an instant of the form
frm.TopLevel = false;
frm.Parent = pnl_main;
frm.Show(); //Display the form
}