Imports System.Windows.Forms

Public Class mdiMain

    Private Sub BorrowBooksToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BorrowBooksToolStripMenuItem.Click
        Dim f As Form = Application.OpenForms.Item("frmBorrow")

        If f Is Nothing Then
            Dim Borrow As New frmBorrow

            With Borrow
                .getFormState = modGlobal.FormState.adStateAddMode

                .MdiParent = Me
                .StartPosition = FormStartPosition.CenterScreen
                .Show()
            End With
        Else
            f.Show()
            f.BringToFront()
        End If
    End Sub

    Private Sub MembersToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MembersToolStripMenuItem.Click
        Dim f As Form = Application.OpenForms.Item("frmMembers")

        If f Is Nothing Then
            Dim Members As New frmMembers

            With Members
                .getFormState = modGlobal.FormState.adStateAddMode

                .MdiParent = Me
                .StartPosition = FormStartPosition.CenterScreen
                .Show()
            End With
        Else
            f.Show()
            f.BringToFront()
        End If
    End Sub

    Private Sub BooksToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BooksToolStripMenuItem.Click
        Dim f As Form = Application.OpenForms.Item("frmBooks")

        If f Is Nothing Then
            Dim Books As New frmBooks

            With Books
                .getFormState = modGlobal.FormState.adStateAddMode

                .MdiParent = Me
                .StartPosition = FormStartPosition.CenterScreen
                .Show()
            End With
        Else
            f.Show()
            f.BringToFront()
        End If
    End Sub

    Private Sub CourseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CourseToolStripMenuItem.Click
        Dim f As Form = Application.OpenForms.Item("frmCourse")

        If f Is Nothing Then
            Dim Course As New frmCourse

            With Course
                .getFormState = modGlobal.FormState.adStateAddMode

                .MdiParent = Me
                .StartPosition = FormStartPosition.CenterScreen
                .Show()
            End With
        Else
            f.Show()
            f.BringToFront()
        End If
    End Sub

    Private Sub SubjectToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SubjectToolStripMenuItem.Click
        Dim f As Form = Application.OpenForms.Item("frmSubject")

        If f Is Nothing Then
            Dim Subject As New frmSubject

            With Subject
                .getFormState = modGlobal.FormState.adStateAddMode

                .MdiParent = Me
                .StartPosition = FormStartPosition.CenterScreen
                .Show()
            End With
        Else
            f.Show()
            f.BringToFront()
        End If
    End Sub

    Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
        Me.Close()
    End Sub

    Private Sub mdiMain_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        End
    End Sub

    Private Sub ReturnBooksToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReturnBooksToolStripMenuItem.Click
        Dim f As Form = Application.OpenForms.Item("frmReturn")

        If f Is Nothing Then
            Dim ReturnBook As New frmReturn

            With ReturnBook
                .getFormState = modGlobal.FormState.adStateAddMode

                .MdiParent = Me
                .StartPosition = FormStartPosition.CenterScreen
                .Show()
            End With
        Else
            f.Show()
            f.BringToFront()
        End If
    End Sub
End Class
