I have a MDI Child form (frmReview) that I aim to show on my maximized parent form with the following code:
Public Sub frmTransport_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
'keyboard shortcuts
If e.KeyCode = Keys.F1 Then LaunchManual()
If e.Control Then
If e.KeyValue = Keys.R Then
Me.WindowState = FormWindowState.Maximized
Dim review As New frmReview
review.MdiParent = Me
review.Location = New Point(1175, 0)
review.BringToFront()
review.Show()
End If
...
...
End Sub
The point (1175, 0) is the top-right corner where the TabControl meets the Yellow mdi Container. The parent form has its isMdiContainer property set to True and Load event of frmReview does fire when i run this code, but I do not see the child form:
In another program I have, I use to same process to display MDI Child Forms and it works fine. Any suggestions on why this is happening?
Thanks in advance!
If you want to display the form in the top right corner, use this
Dim mdiClient = Me.Controls.OfType(Of MdiClient).FirstOrDefault()
Me.WindowState = FormWindowState.Maximized
Dim review As New frmReview
review.MdiParent = Me
review.BringToFront()
review.Show()
' order of Show() call changed so review has a size
review.Location = New Point(mdiClient.Size.Width - review.Width, 0)