Click here to Skip to main content
15,881,413 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all visitors
I have problem with child form in vb.net.
i have 2 forms (1 is parent form and 2 is child form)
on my parent form, i have 1 panel at the left side of form. so the child form will display at the right side.
This is my code when button child1
Dim frm As New frmItemGroup
frm.MdiParent = Me
frm.Show()

when i click on child1 button,it display at the right side. but the child form width is longer than parent form.so i need to scroll if i want to input data to child form.
Anybody know how can i fixed child form match with width of parent form?

Best Regards,
TONY
Posted
Comments
Dr.Walt Fair, PE 21-Aug-11 23:44pm    
Are either of the forms sized dynamically? If not, just change the size of the forms in the designer. We need to know what problem you are having.

There is not parent-child relationships between forms. I don't count MDIChild-MDIParent relationship for MDI, which is a different thing. (Besides, who needs MDI? It is discourages even by Microsoft.) More exactly, the class Form has Parent property as this class is Control and inherits Control.Parent, but an attempt to insert a form into form causes exception. So, this relationship does formally exist in API but does not functionally exist and cannot be used during run time.

Now, about MDI. Here is why I don't recommend it:
http://en.wikipedia.org/wiki/Multiple_document_interface#Disadvantages[^],
Question on using MDI windows in WPF[^],
MDIContainer giving error[^].

Honestly, don't torture yourself and scare off your users. The links above show much better alternatives.

—SA
 
Share this answer
 
have you tried setting the 2nd form's windowstate to maximized? or the width property to something smaller?

Note: using the windowstate = maximized on a mdichild form will also give you issues when you open other child windows as they take on the size of the that window even if you specify the size.

The only wy around it is to either change the window state at runtime or not use the windowstate=maximized
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900