Problem with loading MDI Child Forms.
Good evening everyone. I am wondering if someone can help me with a small problem I've been having with a MDI Application I'm in the process of developing.
I have the following structure so far:
1. MDI Parent: frmMain
2. MDI Child: frmWelcome
When the application loads the MDI Parent automatically loads the frmWelcome into the space provided for the child form.
In the settings of the frmWelcome i disabled the control box, border is set to none and the maximize / minimize buttons are set to false.
The problem i'm having is when the application loads the bar specifically for my parent form menu loads a second set of minimize / maximize / close buttons that belong to the child form. Also the child form is loading a bit cut off at the top. If i click the maximize button it then reloads the form properly and removes the buttons for the child form.
Below is the code found within my parent form for loading new mdi child forms into the application:
Load Form Code
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Loads Welcome Page At Runtime
If CheckIfOpen("frmWelcome") = False Then
Dim fv As New frmWelcome
fv.MdiParent = Me
fv.Show()
fv.Dock = DockStyle.Fill
End If
End Sub
Check if open function (Prevents duplicate forms of being loaded) Private Function CheckIfOpen(ByVal frmName As String) As Boolean
'Code used to prevent duplicate child forms from being opened ontop of eachother.
Dim frm As Form
For Each frm In Me.MdiChildren
If frm.Name = frmName Then
frm.Focus()
Return True
Exit Function
End If
Next
Return False
End Function
Menu Command For Loading the Start Page on click Private Sub mnuHelpWelcome_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuHelpWelcome.Click
'Opens Welcome Page
If CheckIfOpen("frmWelcome") = False Then
Dim fv As New frmWelcome
fv.MdiParent = Me
fv.Show()
fv.Dock = DockStyle.Fill
End If
End Sub
Thank you in advance for any help you can send my way that way I can get this resolved before I begin developing other forms in my application.
Thanks,
David Watson
|