forms design c#
-
Saturday, July 21, 2012 12:24 PM
hi
my requirement is as follows. the form should be divided into two sections. the left side of the screens should contain heirarchical
tree. when the user clicks the node corresponding form should open on the write side (i tried using a spilt container but does'nt work).
only one form should be open at any time.Quick help appreciated.
Thanks
Richards
All Replies
-
Sunday, July 22, 2012 6:12 AMWe cannot help you if you don't describe how you attempted this. You mention a split container, but you don't detail how this control failed you, as others have successfully used it. So describe your form in more detail and also show any code connecting the pieces together.
Jose R. MCP
Code Samples -
Monday, July 23, 2012 3:05 AM
Hi
I will explain with a button in panel1 spiltcontainer instead of heirarchical tree.
1)I first changed form1 properties to mdi parent = true in the property box.
2) i then dragged and dropped a spiltcontainer on to form one.
3)I created another form form2.
4) I added a button to spiltcontainer panel1
5)i added the following code to button.
Form2 frm = new Form2();
this.splitContainer1.Panel2.Controls.Add(frm);
frm.Show();but i get error.
please help
-
Tuesday, July 24, 2012 8:05 AMModerator
Hi Richards123,
If a form is top-level, its parent is the desktop window. The form cannot be added to other controls. You have to set the TopLevel property to false.
Form2 frm = new Form2(); frm.TopLevel = false; this.splitContainer1.Panel2.Controls.Add(frm); frm.Show();
By the way, if you would like to put new form to Panel2, I think you don't have to set the form1's IsMdiParent property.
If there are any questions, please feel free to let me know.
Best regards,
Chester Hong
MSDN Community Support | Feedback to us
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- Marked As Answer by Richards123 Tuesday, July 24, 2012 4:00 PM


