
Imports DataGrid_DataSet_DataTable.ExceptionHandler

Module ModuleMain

    'Nbr Forms Existing
    Private _NbrForms As Integer
    'Reference To Forms
    Private _frmMain As frmMain
    Private _frmDataGrid As frmDataGrid

    'Use Sub Main So Visual Styles Can Be Enabled And The Login Form Destroyed
    Public Sub Main()
        'Reason For Using Sub Main Came From "Upgrading Microsoft Visual Basic 6.0 To Microsoft Visual Basic .NET" By Ed Robinson, Michael Bond And Robert Ian Oliver
        'Error Handler Came From "User Friendly Exception Handling" By wumpus1. Published on The Code Project Web Site 
        UnhandledExceptionManager.AddHandler()
        'Application.EnableVisualStyles() 'Allow XP Styles To Be Used - Causes App To Crash
        'Show The MyLogin Form And Keep A Reference To It
        Dim StartFormf As New frmMain
        StartFormf.Show()
        'Start The Application Object Running
        Application.Run()

    End Sub

    Public Sub AddForm()
        _NbrForms += 1
    End Sub

    Public Sub SubForm()
        _NbrForms -= 1
        If _NbrForms = 0 Then
            Application.Exit()
        End If
    End Sub

    Public Property frmMainRef() As Form
        Get
            Return _frmMain
        End Get
        Set(ByVal Value As Form)
            _frmMain = Value
        End Set
    End Property

    Public Property frmDataGridRef() As Form
        Get
            Return _frmDataGrid
        End Get
        Set(ByVal Value As Form)
            _frmDataGrid = Value
        End Set
    End Property

End Module
