Private Sub LaunchDialog(ByVal dialogType As System.Type) '-- All new forms are based on the following class: ' CardTrackingSystem.UI.Windows.Forms.ApplicationBaseForm Try Dim newFormToBeLaunched As CardTrackingSystem.UI.Windows.Forms.ApplicationBaseForm newFormToBeLaunched = CType(Activator.CreateInstance(dialogType), Form) '-- Check if the form exist in the MDI collection and if so, bring it to the from. For Each currentLoadedForm As Form In Me._MDIClient.Controls If currentLoadedForm.Name.Equals(newFormToBeLaunched.Name, StringComparison.CurrentCultureIgnoreCase) Then '-- IF the form is minimized then restore it. If currentLoadedForm.WindowState = FormWindowState.Minimized Then currentLoadedForm.WindowState = FormWindowState.Normal End If '-- Dispose the newly created instance and use the current one newFormToBeLaunched.Dispose() newFormToBeLaunched = Nothing '-- Show the form on top of the others. currentLoadedForm.BringToFront() Exit Sub End If Next '-- If the form was not found as part of the MDI control, then add it AddFormHandlers(newFormToBeLaunched) '-- Set the parent MDI newFormToBeLaunched.MdiParent = Me '-- Show the dialog newFormToBeLaunched.Show() '-- Update the Open Window Items SetOpenWindowsItems(CType(newFormToBeLaunched, ApplicationBaseForm)) Catch ex As Exception Me.ShowMessageByKey("FormNoAvailableYet", My.Application.Info.Title) End Try End Sub