Hi Guys,
An issues is observe relevant to form size. A sub form is called from main application and it's size differs with the size mentioned at designed time. As a result, it didn't show the buttons at bottom to perform actions.
Find sample code in attachment.
Please, Help me in this regard.
Thanks,
Itz.Irshad
Loading
FroglegPosted Apr 16, 2012, 2:01 AM
Sam HobbsPosted Apr 17, 2012, 2:16 AM
I assume you found the other thread before I replied. My solution works and is easier. All you had to change is to modify the one property from False to True.
It is true that it is normal for the Windows window to not be created before the ShowDialog, but there is no reason why the .Net class cannot use the location that is specified for the form's Location property when the form (window) is created. The problem is likely that VB cannot calculate the size correctly until after the window is created. If however that is true then VB has a problem since it is not showing the size properly in the designer in VS.
Muhammad IrshadPosted Apr 17, 2012, 12:40 AM
I got its solution with the help of an article from http://stackoverflow.com/questions/1535821/net-form-setting-location-changes-size
This show me a reason of this.
Actually, I'm setting sub-form location in main form and still sub form is not loaded. According to winform lifecycle, I should specify its location in the load of form.
When I do that, it is shown in proper location as I wanted.
Thanks,
Regards,
Itz.Irshad
Sam HobbsPosted Apr 16, 2012, 3:19 PM
If I comment out the line "frmSubForm.Location() = New Point(8, 425)" then the form is shown at the correct size but not the correct position of course.
If I set the frmSubForm's AutoSize property to True then the form is shown as you intend I think. I do not understand why though. The question remains of why the form is resized when AutoSize is off but the form is shown as it is shown in the designer when AutoSize is on.
Muhammad IrshadPosted Apr 16, 2012, 2:05 AM
Yeah, its good work around for that. But, can you explain me what is the reason behind this action. It is implicitly done by VS but why ?
Thanks.