Vb.net – Maximized state of child form Not working correctly when used in MDI container (Visual Basic 2013)

vb.netvisual studio 2010visual-studio-2013winforms

I am having this weird problem in Visual Basic (2013). I have a form in MDI container. Both of them, have property WindowState to Maximized. While executing, MDI container loads in maximized state (So far Ok!). But, when I open the child form, it Does NOT give the Actual Maximized state appearance (although Restore button on top right shows that it has loaded in maximized state, but it did not maximized).

I even tried with form1.WindowState = FormWindowState.Maximized both before and after form1.Show(), but no luck.

I have attached a screenshot too. Note the dead space of MDI container and Restore icon of child form (which means child form is in maximized state).

screenshot of VB problem

Few observations –

  1. When I restore and then again maximize it, it DOES maximize correctly.

  2. I also observed that this problem is occurs only for one time. I mean, if I have 2 forms both set to load in Maximized state. When I open the first form (no matter which), it loads like i showed in the screenshot, and after that when I open 2nd form, it loads in maximized state.

I could not figure out, what went wrong? How to correct this?

Best Answer

go to your form properties. Set windowsState = normal. then put this to code

    Dim frmC As New frmChild
    frmC.MdiParent = Me
    frmC.WindowState = FormWindowState.Maximized
    frmC.Show()