Private Sub frdSupSim_Load(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
Thread.CurrentThread.Name = "SupSim Primary"
' If End User Licence Agreement acceptance is required, show the splash
' screen and get the user's acceptance or rejection of the agreement.
Dim frmSplash As frdSplash = Nothing
Try
mdptSplashLocation = Point.Empty
If (EULA_AcceptanceRequired()) Then
frmSplash = New frdSplash(frdSplash.aenmSplashMode.Agreement)
' The EULA acceptance form will be centered on the application window.
' (Because the application window is not yet in its specified location,
' a reference rectangle is used for centering the EULA acceptance form.)
Dim dreApplication As Rectangle = FormPosition(Me)
frmSplash.StartPosition = FormStartPosition.Manual
frmSplash.Left = dreApplication.Left + CInt((dreApplication.Width - frmSplash.Width) / 2)
frmSplash.Top = dreApplication.Top + CInt((dreApplication.Height - frmSplash.Height) / 2)
mdptSplashLocation = frmSplash.Location
frmSplash.ApplicationTitle = gkstMsgAppTitle
frmSplash.ShowDialog()
abooAborting = (frmSplash.EULA_Accepted <> aenmTripleState.Yes) ' If the user doesn't agree,
End If ' abort the startup.
Catch ex As Exception
abooAborting = True ' An error during user acceptance will also abort the startup.
ReportError(ex) ' Report unexpected errors.
Finally
If (frmSplash IsNot Nothing) Then
frmSplash.Close()
End If
If (abooAborting) Then
' The user rejected the EULA (or an error occurred).
Me.Close()
End If
End Try
If (abooAborting) Then Exit Sub
' Define this as the main form so that it is easily available globally.
gfrmMain = Me ' GUI specific reference (type = frdSupSim).
afrmMaster = Me ' General reference (type = Form).
aicnDefault = Me.Icon ' Set the default icon for this application.
afrmDebug = Me '~TBR (For debugging purposes only.)
UpdateStatusBar() ' Clear design text from status bar.
UpdateToolBar()
' Define standard object types for global reference:
gtypUnitControlDef = GetType(clsUnitControlDef)
' Set form/window geometry.
PositionForm(Me)
End Sub
I think there is nothing very unusual in there. The object gfrmMain is referenced in subsequent events (Activated and Resize) and being Null of course causes subsequent problems there.