If I feel like completely lost, I will cry for help.
Sounds good.
just need to find a nice peace of paper.
I don't know that one exists. Here is a sample method to load up all of your client forms in the MDI.
Declare the form collection
''' <summary>
''' Collection of all of the forms
''' </summary>
''' <remarks></remarks>
Private _Forms As New System.Collections.Generic.Dictionary(Of Integer, System.Windows.Forms.Form)
Create a reusable method to load a child form
''' <summary>
''' A reusable method that allows forms to be launched. This will reside in your
''' MDI form.
''' </summary>
''' <param name="FormType"></param>
''' <remarks></remarks>
Public Sub LoadForm(ByVal FormType As System.Type)
'-- Establish Locals
Dim loForm As System.Windows.Forms.Form
'-- Create the form
loForm = CType(Activator.CreateInstance(FormType), Form)
'-- Associate the new form with the MDI form
loForm.MdiParent = Me
'-- Add a handler to the form close
AddHandler loForm.FormClosed, AddressOf HandleFormClosed
'-- This is a good place to update your open form collection
_Forms.Add(loForm.Handle.ToInt32(), loForm)
'-- Update the list or menu
'-- Show the form
loForm.Show()
End Sub
Create a handler method that is used to trap the FormClosed event. This will be assigned in the LoadForm() method
''' <summary>
''' Handles the closing of the form
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub HandleFormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs)
'-- Establish Locals
Dim loForm As System.Windows.Forms.Form
'-- The sender will be the form. See if the form is in the collection
If _Forms.ContainsKey(CType(sender, Form).Handle.ToInt32()) Then
'-- Get the form reference
loForm = _Forms(CType(sender, Form).Handle.ToInt32())
'-- Remove the handler
RemoveHandler loForm.FormClosed, AddressOf HandleFormClosed
'-- Remove from the collection
_Forms.Remove(CType(sender, Form).Handle.ToInt32())
'-- Update your list or menu
End If
End Sub
Sample method showing how to call the LoadForm method
''' <summary>
''' Just a sample of how to call the LoadForm method
''' </summary>
''' <remarks></remarks>
Private Sub SampleLoadingForm()
LoadForm(GetType(MyForm))
End Sub