Imports System.Data.OleDb
Imports System.IO

Public Class TimerFrm

    Private Sub LinkLblCabin1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLblCabin1.LinkClicked

        Try
            If Me.TimerCabin1.Enabled = False Then
                EntryFrm.CBFormState.SelectedItem = "1"
                EntryFrm.ShowDialog()
                Return
            End If
        Catch ex As Exception
        End Try

        If Me.TimerCabin1.Enabled = True Then
            Dim dr1 As OleDbDataReader
            Dim com1 As New OleDbCommand

            Try
                With OleCn
                    If .State <> ConnectionState.Open Then
                        .ConnectionString = StrConnection()
                        .Open()
                    End If
                End With
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Try

                com1.CommandText = "select [SerialNo],[CabinNo],[Dat],[CustomerName],[ID_Proof],[Particular] from Table1 where SerialNo = " & Me.TxtSnoCabin1.Text & ""
                com1.Connection = OleCn

                dr1 = com1.ExecuteReader
                If dr1.Read Then
                    ' EntryFrm.Show()
                    Dim obj As New EntryFrm2
                    obj.WindowState = FormWindowState.Normal
                    obj.CBFormState.Text = "1"
                    obj.txtSerialNo.Text = UCase(dr1(0)).ToString()
                    'obj.CBFormState.SelectedItem = dr1(1).ToString()
                    obj.txtDate.Value = UCase(dr1(2)).ToString()
                    obj.txtName.Text = UCase(dr1(3)).ToString()
                    obj.TxtIDProof.Text = UCase(dr1(4)).ToString()
                    obj.TxtParticular.Text = UCase(dr1(5)).ToString()
                    obj.TxtLogin.Text = Me.LblTimeCabin1.Text
                    obj.txtLogout.Text = Now.ToLongTimeString.ToString
                    obj.TxtDuration.Text = Me.LblDurationCabin1.Text
                    obj.ShowDialog()
                Else
                    MessageBox.Show("This user record is deleted. Please re-enter this user information", "Record Deleted", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    EntryFrm.CBFormState.SelectedItem = "1"
                    EntryFrm.ShowDialog()
                End If
                OleCn.Close()
                dr1.Close()

            Catch ex As Exception
                MessageBox.Show(ex.Message, "User-Logout Error:", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Return
        End If

    End Sub

    Private Sub TimerCabin1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerCabin1.Tick
        'TxtLogoutTimeCabin1.Text = Now.ToLongTimeString.ToString
        Try
            Dim StartTime As DateTime = Me.LblTimeCabin1.Text
            Dim EndTime As DateTime = Now.ToLongTimeString.ToString
            Dim TotalTime As TimeSpan = EndTime - StartTime
            Me.LblDurationCabin1.Text = (TotalTime).ToString
        Catch ex As Exception
            '  MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub TimerCabin2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerCabin2.Tick
        'TxtLogoutTimeCabin2.Text = Now.ToLongTimeString.ToString
        Try
            Dim StartTime As DateTime = Me.LblTimeCabin2.Text
            Dim EndTime As DateTime = Now.ToLongTimeString.ToString
            Dim TotalTime As TimeSpan = EndTime - StartTime
            Me.LblDurationCabin2.Text = (TotalTime).ToString
        Catch ex As Exception
            '  MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub TimerCabin3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerCabin3.Tick
        ' TxtLogoutTimeCabin3.Text = Now.ToLongTimeString.ToString
        Try
            Dim StartTime As DateTime = Me.LblTimeCabin3.Text
            Dim EndTime As DateTime = Now.ToLongTimeString.ToString
            Dim TotalTime As TimeSpan = EndTime - StartTime
            Me.LblDurationCabin3.Text = (TotalTime).ToString
        Catch ex As Exception
            '  MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub TimerCabin4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerCabin4.Tick
        ' TxtLogoutTimeCabin4.Text = Now.ToLongTimeString.ToString
        Try
            Dim StartTime As DateTime = Me.LblTimeCabin4.Text
            Dim EndTime As DateTime = Now.ToLongTimeString.ToString
            Dim TotalTime As TimeSpan = EndTime - StartTime
            Me.LblDurationCabin4.Text = (TotalTime).ToString
        Catch ex As Exception
            '  MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub TimerCabin5_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerCabin5.Tick
        ' TxtLogoutTimeCabin5.Text = Now.ToLongTimeString.ToString
        Try
            Dim StartTime As DateTime = Me.LblTimeCabin5.Text
            Dim EndTime As DateTime = Now.ToLongTimeString.ToString
            Dim TotalTime As TimeSpan = EndTime - StartTime
            Me.LblDurationCabin5.Text = (TotalTime).ToString
        Catch ex As Exception
            '  MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub TimerCabin6_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerCabin6.Tick
        ' TxtLogoutTimeCabin6.Text = Now.ToLongTimeString.ToString
        Try
            Dim StartTime As DateTime = Me.LblTimeCabin6.Text
            Dim EndTime As DateTime = Now.ToLongTimeString.ToString
            Dim TotalTime As TimeSpan = EndTime - StartTime
            Me.LblDurationCabin6.Text = (TotalTime).ToString
        Catch ex As Exception
            '  MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub TimerCabin7_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerCabin7.Tick
        'TxtLogoutTimeCabin7.Text = Now.ToLongTimeString.ToString
        Try
            Dim StartTime As DateTime = Me.LblTimeCabin7.Text
            Dim EndTime As DateTime = Now.ToLongTimeString.ToString
            Dim TotalTime As TimeSpan = EndTime - StartTime
            Me.LblDurationCabin7.Text = (TotalTime).ToString
        Catch ex As Exception
            '  MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub TimerCabin8_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TimerCabin8.Tick
        ' TxtLogoutTimeCabin8.Text = Now.ToLongTimeString.ToString
        Try
            Dim StartTime As DateTime = Me.LblTimeCabin8.Text
            Dim EndTime As DateTime = Now.ToLongTimeString.ToString
            Dim TotalTime As TimeSpan = EndTime - StartTime
            Me.LblDurationCabin8.Text = (TotalTime).ToString
        Catch ex As Exception
            '  MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub TimerCabin9_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TimerCabin9.Tick
        ' TxtLogoutTimeCabin9.Text = Now.ToLongTimeString.ToString
        Try
            Dim StartTime As DateTime = Me.LblTimeCabin9.Text
            Dim EndTime As DateTime = Now.ToLongTimeString.ToString
            Dim TotalTime As TimeSpan = EndTime - StartTime
            Me.LblDurationCabin9.Text = (TotalTime).ToString
        Catch ex As Exception
            '  MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub TimerCabin10_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TimerCabin10.Tick
        '  TxtLogoutTimeCabin10.Text = Now.ToLongTimeString.ToString
        Try
            Dim StartTime As DateTime = Me.LblTimeCabin10.Text
            Dim EndTime As DateTime = Now.ToLongTimeString.ToString
            Dim TotalTime As TimeSpan = EndTime - StartTime
            Me.LblDurationCabin10.Text = (TotalTime).ToString
        Catch ex As Exception
            ' MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub TimerCabin11_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TimerCabin11.Tick
        'TxtLogoutTimeCabin11.Text = Now.ToLongTimeString.ToString
        Try
            Dim StartTime As DateTime = Me.LblTimeCabin11.Text
            Dim EndTime As DateTime = Now.ToLongTimeString.ToString
            Dim TotalTime As TimeSpan = EndTime - StartTime
            Me.LblDurationCabin11.Text = (TotalTime).ToString
        Catch ex As Exception
            ' MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub TimerCabin12_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TimerCabin12.Tick
        ' TxtLogoutTimeCabin12.Text = Now.ToLongTimeString.ToString
        Try
            Dim StartTime As DateTime = Me.LblTimeCabin12.Text
            Dim EndTime As DateTime = Now.ToLongTimeString.ToString
            Dim TotalTime As TimeSpan = EndTime - StartTime
            Me.LblDurationCabin12.Text = (TotalTime).ToString
        Catch ex As Exception
            ' MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub TimerCabin13_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TimerCabin13.Tick
        ' TxtLogoutTimeCabin13.Text = Now.ToLongTimeString.ToString
        Try
            Dim StartTime As DateTime = Me.LblTimeCabin13.Text
            Dim EndTime As DateTime = Now.ToLongTimeString.ToString
            Dim TotalTime As TimeSpan = EndTime - StartTime
            Me.LblDurationCabin13.Text = (TotalTime).ToString
        Catch ex As Exception
            'MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub TimerCabin14_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TimerCabin14.Tick
        '  TxtLogoutTimeCabin14.Text = Now.ToLongTimeString.ToString
        Try
            Dim StartTime As DateTime = Me.LblTimeCabin14.Text
            Dim EndTime As DateTime = Now.ToLongTimeString.ToString
            Dim TotalTime As TimeSpan = EndTime - StartTime
            Me.LblDurationCabin14.Text = (TotalTime).ToString
        Catch ex As Exception
            ' MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub TimerCabin15_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TimerCabin15.Tick
        ' TxtLogoutTimeCabin15.Text = Now.ToLongTimeString.ToString
        Try
            Dim StartTime As DateTime = Me.LblTimeCabin15.Text
            Dim EndTime As DateTime = Now.ToLongTimeString.ToString
            Dim TotalTime As TimeSpan = EndTime - StartTime
            Me.LblDurationCabin15.Text = (TotalTime).ToString
        Catch ex As Exception
            ' MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub TimerCabin16_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TimerCabin16.Tick
        '  TxtLogoutTimeCabin16.Text = Now.ToLongTimeString.ToString
        Try
            Dim StartTime As DateTime = Me.LblTimeCabin16.Text
            Dim EndTime As DateTime = Now.ToLongTimeString.ToString
            Dim TotalTime As TimeSpan = EndTime - StartTime
            Me.LblDurationCabin16.Text = (TotalTime).ToString
        Catch ex As Exception
            '  MessageBox.Show(ex.Message)
        End Try
    End Sub


    Private Sub TimerCabin17_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TimerCabin17.Tick
        ' TxtLogoutTimeCabin17.Text = Now.ToLongTimeString.ToString
        Try
            Dim StartTime As DateTime = Me.LblTimeCabin17.Text
            Dim EndTime As DateTime = Now.ToLongTimeString.ToString
            Dim TotalTime As TimeSpan = EndTime - StartTime
            Me.LblDurationCabin17.Text = (TotalTime).ToString
        Catch ex As Exception
            ' MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub TimerCabin18_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TimerCabin18.Tick
        ' TxtLogoutTimeCabin18.Text = Now.ToLongTimeString.ToString
        Try
            Dim StartTime As DateTime = Me.LblTimeCabin18.Text
            Dim EndTime As DateTime = Now.ToLongTimeString.ToString
            Dim TotalTime As TimeSpan = EndTime - StartTime
            Me.LblDurationCabin18.Text = (TotalTime).ToString
        Catch ex As Exception
            '  MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub TimerCabin19_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TimerCabin19.Tick
        ' TxtLogoutTimeCabin19.Text = Now.ToLongTimeString.ToString
        Try
            Dim StartTime As DateTime = Me.LblTimeCabin19.Text
            Dim EndTime As DateTime = Now.ToLongTimeString.ToString
            Dim TotalTime As TimeSpan = EndTime - StartTime
            Me.LblDurationCabin19.Text = (TotalTime).ToString
        Catch ex As Exception
            ' MessageBox.Show(ex.Message)
        End Try
    End Sub

    Private Sub TimerCabin20_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TimerCabin20.Tick
        ' TxtLogoutTimeCabin20.Text = Now.ToLongTimeString.ToString
        Try
            Dim StartTime As DateTime = Me.LblTimeCabin20.Text
            Dim EndTime As DateTime = Now.ToLongTimeString.ToString
            Dim TotalTime As TimeSpan = EndTime - StartTime
            Me.LblDurationCabin20.Text = (TotalTime).ToString
        Catch ex As Exception
            ' MessageBox.Show(ex.Message)
        End Try
    End Sub
    Private Sub LinkLblCabin2_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLblCabin2.LinkClicked

        Try
            If Me.TimerCabin2.Enabled = False Then
                EntryFrm.CBFormState.SelectedItem = "2"
                EntryFrm.ShowDialog()
                Return
            End If
        Catch ex As Exception
        End Try

        If Me.TimerCabin2.Enabled = True Then
            Dim dr1 As OleDbDataReader
            Dim com1 As New OleDbCommand

            Try
                With OleCn
                    If .State <> ConnectionState.Open Then
                        .ConnectionString = StrConnection()
                        .Open()
                    End If
                End With
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Try
                com1.CommandText = "select [SerialNo],[CabinNo],[Dat],[CustomerName],[ID_Proof],[Particular] from Table1 where SerialNo = " & Me.TxtSnoCabin2.Text & ""
                com1.Connection = OleCn

                dr1 = com1.ExecuteReader
                If dr1.Read Then
                    ' EntryFrm.Show()
                    Dim obj As New EntryFrm2
                    obj.WindowState = FormWindowState.Normal
                    obj.CBFormState.Text = "2"
                    obj.txtSerialNo.Text = UCase(dr1(0)).ToString()
                    'obj.CBFormState.SelectedItem = dr1(1).ToString()
                    obj.txtDate.Value = UCase(dr1(2)).ToString()
                    obj.txtName.Text = UCase(dr1(3)).ToString()
                    obj.TxtIDProof.Text = UCase(dr1(4)).ToString()
                    obj.TxtParticular.Text = UCase(dr1(5)).ToString()
                    obj.TxtLogin.Text = Me.LblTimeCabin2.Text
                    obj.txtLogout.Text = Now.ToLongTimeString.ToString
                    obj.TxtDuration.Text = Me.LblDurationCabin2.Text
                    obj.ShowDialog()
                Else
                    MessageBox.Show("This user record is deleted. Please re-enter this user information", "Record Deleted", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    EntryFrm.CBFormState.SelectedItem = "2"
                    EntryFrm.ShowDialog()
                End If
                OleCn.Close()
                dr1.Close()

            Catch ex As Exception
                MessageBox.Show(ex.Message, "User-Logout Error:", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Return
        End If

    End Sub

    Private Sub LinkLblCabin3_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLblCabin3.LinkClicked

        Try
            If Me.TimerCabin3.Enabled = False Then
                EntryFrm.CBFormState.SelectedItem = "3"
                EntryFrm.ShowDialog()
                Return
            End If
        Catch ex As Exception
        End Try

        If Me.TimerCabin3.Enabled = True Then
            Dim dr1 As OleDbDataReader
            Dim com1 As New OleDbCommand

            Try
                With OleCn
                    If .State <> ConnectionState.Open Then
                        .ConnectionString = StrConnection()
                        .Open()
                    End If
                End With
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Try
                com1.CommandText = "select [SerialNo],[CabinNo],[Dat],[CustomerName],[ID_Proof],[Particular] from Table1 where SerialNo = " & Me.TxtSnoCabin3.Text & ""
                com1.Connection = OleCn

                dr1 = com1.ExecuteReader
                If dr1.Read Then
                    ' EntryFrm.Show()
                    Dim obj As New EntryFrm2
                    obj.WindowState = FormWindowState.Normal
                    obj.CBFormState.Text = "3"
                    obj.txtSerialNo.Text = UCase(dr1(0)).ToString()
                    'obj.CBFormState.SelectedItem = dr1(1).ToString()
                    obj.txtDate.Value = UCase(dr1(2)).ToString()
                    obj.txtName.Text = UCase(dr1(3)).ToString()
                    obj.TxtIDProof.Text = UCase(dr1(4)).ToString()
                    obj.TxtParticular.Text = UCase(dr1(5)).ToString()
                    obj.TxtLogin.Text = Me.LblTimeCabin3.Text
                    obj.txtLogout.Text = Now.ToLongTimeString.ToString
                    obj.TxtDuration.Text = Me.LblDurationCabin3.Text
                    obj.ShowDialog()
                Else
                    MessageBox.Show("This user record is deleted. Please re-enter this user information", "Record Deleted", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    EntryFrm.CBFormState.SelectedItem = "3"
                    EntryFrm.ShowDialog()
                End If
                OleCn.Close()
                dr1.Close()

            Catch ex As Exception
                MessageBox.Show(ex.Message, "User-Logout Error:", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Return
        End If
    End Sub

    Private Sub LinkLblCabin4_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLblCabin4.LinkClicked

        Try
            If Me.TimerCabin4.Enabled = False Then
                EntryFrm.CBFormState.SelectedItem = "4"
                EntryFrm.ShowDialog()
                Return
            End If
        Catch ex As Exception
        End Try

        If Me.TimerCabin4.Enabled = True Then
            Dim dr1 As OleDbDataReader
            Dim com1 As New OleDbCommand

            Try
                With OleCn
                    If .State <> ConnectionState.Open Then
                        .ConnectionString = StrConnection()
                        .Open()
                    End If
                End With
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Try
                com1.CommandText = "select [SerialNo],[CabinNo],[Dat],[CustomerName],[ID_Proof],[Particular] from Table1 where SerialNo = " & Me.TxtSnoCabin4.Text & ""
                com1.Connection = OleCn

                dr1 = com1.ExecuteReader
                If dr1.Read Then
                    ' EntryFrm.Show()
                    Dim obj As New EntryFrm2
                    obj.WindowState = FormWindowState.Normal
                    obj.CBFormState.Text = "4"
                    obj.txtSerialNo.Text = UCase(dr1(0)).ToString()
                    'obj.CBFormState.SelectedItem = dr1(1).ToString()
                    obj.txtDate.Value = UCase(dr1(2)).ToString()
                    obj.txtName.Text = UCase(dr1(3)).ToString()
                    obj.TxtIDProof.Text = UCase(dr1(4)).ToString()
                    obj.TxtParticular.Text = UCase(dr1(5)).ToString()
                    obj.TxtLogin.Text = Me.LblTimeCabin4.Text
                    obj.txtLogout.Text = Now.ToLongTimeString.ToString
                    obj.TxtDuration.Text = Me.LblDurationCabin4.Text
                    obj.ShowDialog()
                Else
                    MessageBox.Show("This user record is deleted. Please re-enter this user information", "Record Deleted", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    EntryFrm.CBFormState.SelectedItem = "4"
                    EntryFrm.ShowDialog()
                End If
                OleCn.Close()
                dr1.Close()

            Catch ex As Exception
                MessageBox.Show(ex.Message, "User-Logout Error:", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Return
        End If
    End Sub

    Private Sub LinkLblCabin5_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLblCabin5.LinkClicked

        Try
            If Me.TimerCabin5.Enabled = False Then
                EntryFrm.CBFormState.SelectedItem = "5"
                EntryFrm.ShowDialog()
                Return
            End If
        Catch ex As Exception
        End Try

        If Me.TimerCabin5.Enabled = True Then
            Dim dr1 As OleDbDataReader
            Dim com1 As New OleDbCommand

            Try
                With OleCn
                    If .State <> ConnectionState.Open Then
                        .ConnectionString = StrConnection()
                        .Open()
                    End If
                End With
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Try
                com1.CommandText = "select [SerialNo],[CabinNo],[Dat],[CustomerName],[ID_Proof],[Particular] from Table1 where SerialNo = " & Me.TxtSnoCabin5.Text & ""
                com1.Connection = OleCn

                dr1 = com1.ExecuteReader
                If dr1.Read Then
                    ' EntryFrm.Show()
                    Dim obj As New EntryFrm2
                    obj.WindowState = FormWindowState.Normal
                    obj.CBFormState.Text = "5"
                    obj.txtSerialNo.Text = UCase(dr1(0)).ToString()
                    'obj.CBFormState.SelectedItem = dr1(1).ToString()
                    obj.txtDate.Value = UCase(dr1(2)).ToString()
                    obj.txtName.Text = UCase(dr1(3)).ToString()
                    obj.TxtIDProof.Text = UCase(dr1(4)).ToString()
                    obj.TxtParticular.Text = UCase(dr1(5)).ToString()
                    obj.TxtLogin.Text = Me.LblTimeCabin5.Text
                    obj.txtLogout.Text = Now.ToLongTimeString.ToString
                    obj.TxtDuration.Text = Me.LblDurationCabin5.Text
                    obj.ShowDialog()
                Else
                    MessageBox.Show("This user record is deleted. Please re-enter this user information", "Record Deleted", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    EntryFrm.CBFormState.SelectedItem = "5"
                    EntryFrm.ShowDialog()
                End If
                OleCn.Close()
                dr1.Close()

            Catch ex As Exception
                MessageBox.Show(ex.Message, "User-Logout Error:", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Return
        End If

    End Sub

    Private Sub LinkLblCabin6_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLblCabin6.LinkClicked

        Try
            If Me.TimerCabin6.Enabled = False Then
                EntryFrm.CBFormState.SelectedItem = "6"
                EntryFrm.ShowDialog()
                Return
            End If
        Catch ex As Exception
        End Try

        If Me.TimerCabin6.Enabled = True Then
            Dim dr1 As OleDbDataReader
            Dim com1 As New OleDbCommand

            Try
                With OleCn
                    If .State <> ConnectionState.Open Then
                        .ConnectionString = StrConnection()
                        .Open()
                    End If
                End With
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Try
                com1.CommandText = "select [SerialNo],[CabinNo],[Dat],[CustomerName],[ID_Proof],[Particular] from Table1 where SerialNo = " & Me.TxtSnoCabin6.Text & ""
                com1.Connection = OleCn

                dr1 = com1.ExecuteReader
                If dr1.Read Then
                    ' EntryFrm.Show()
                    Dim obj As New EntryFrm2
                    obj.WindowState = FormWindowState.Normal
                    obj.CBFormState.Text = "6"
                    obj.txtSerialNo.Text = UCase(dr1(0)).ToString()
                    'obj.CBFormState.SelectedItem = dr1(1).ToString()
                    obj.txtDate.Value = UCase(dr1(2)).ToString()
                    obj.txtName.Text = UCase(dr1(3)).ToString()
                    obj.TxtIDProof.Text = UCase(dr1(4)).ToString()
                    obj.TxtParticular.Text = UCase(dr1(5)).ToString()
                    obj.TxtLogin.Text = Me.LblTimeCabin6.Text
                    obj.txtLogout.Text = Now.ToLongTimeString.ToString
                    obj.TxtDuration.Text = Me.LblDurationCabin6.Text
                    obj.ShowDialog()
                Else
                    MessageBox.Show("This user record is deleted. Please re-enter this user information", "Record Deleted", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    EntryFrm.CBFormState.SelectedItem = "6"
                    EntryFrm.ShowDialog()
                End If
                OleCn.Close()
                dr1.Close()

            Catch ex As Exception
                MessageBox.Show(ex.Message, "User-Logout Error:", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Return
        End If

    End Sub

    Private Sub LinkLblCabin7_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLblCabin7.LinkClicked

        Try
            If Me.TimerCabin7.Enabled = False Then
                EntryFrm.CBFormState.SelectedItem = "7"
                EntryFrm.ShowDialog()
                Return
            End If
        Catch ex As Exception
        End Try

        If Me.TimerCabin7.Enabled = True Then
            Dim dr1 As OleDbDataReader
            Dim com1 As New OleDbCommand

            Try
                With OleCn
                    If .State <> ConnectionState.Open Then
                        .ConnectionString = StrConnection()
                        .Open()
                    End If
                End With
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Try
                com1.CommandText = "select [SerialNo],[CabinNo],[Dat],[CustomerName],[ID_Proof],[Particular] from Table1 where SerialNo = " & Me.TxtSnoCabin7.Text & ""
                com1.Connection = OleCn

                dr1 = com1.ExecuteReader
                If dr1.Read Then
                    ' EntryFrm.Show()
                    Dim obj As New EntryFrm2
                    obj.WindowState = FormWindowState.Normal
                    obj.CBFormState.Text = "7"
                    obj.txtSerialNo.Text = UCase(dr1(0)).ToString()
                    'obj.CBFormState.SelectedItem = dr1(1).ToString()
                    obj.txtDate.Value = UCase(dr1(2)).ToString()
                    obj.txtName.Text = UCase(dr1(3)).ToString()
                    obj.TxtIDProof.Text = UCase(dr1(4)).ToString()
                    obj.TxtParticular.Text = UCase(dr1(5)).ToString()
                    obj.TxtLogin.Text = Me.LblTimeCabin7.Text
                    obj.txtLogout.Text = Now.ToLongTimeString.ToString
                    obj.TxtDuration.Text = Me.LblDurationCabin7.Text
                    obj.ShowDialog()
                Else
                    MessageBox.Show("This user record is deleted. Please re-enter this user information", "Record Deleted", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    EntryFrm.CBFormState.SelectedItem = "7"
                    EntryFrm.ShowDialog()
                End If
                OleCn.Close()
                dr1.Close()

            Catch ex As Exception
                MessageBox.Show(ex.Message, "User-Logout Error:", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Return
        End If

    End Sub

    Private Sub LinkLblCabin8_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLblCabin8.LinkClicked

        Try
            If Me.TimerCabin8.Enabled = False Then
                EntryFrm.CBFormState.SelectedItem = "8"
                EntryFrm.ShowDialog()
                Return
            End If
        Catch ex As Exception
        End Try

        If Me.TimerCabin8.Enabled = True Then
            Dim dr1 As OleDbDataReader
            Dim com1 As New OleDbCommand

            Try
                With OleCn
                    If .State <> ConnectionState.Open Then
                        .ConnectionString = StrConnection()
                        .Open()
                    End If
                End With
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Try
                com1.CommandText = "select [SerialNo],[CabinNo],[Dat],[CustomerName],[ID_Proof],[Particular] from Table1 where SerialNo = " & Me.TxtSnoCabin8.Text & ""
                com1.Connection = OleCn

                dr1 = com1.ExecuteReader
                If dr1.Read Then
                    ' EntryFrm.Show()
                    Dim obj As New EntryFrm2
                    obj.WindowState = FormWindowState.Normal
                    obj.CBFormState.Text = "8"
                    obj.txtSerialNo.Text = UCase(dr1(0)).ToString()
                    'obj.CBFormState.SelectedItem = dr1(1).ToString()
                    obj.txtDate.Value = UCase(dr1(2)).ToString()
                    obj.txtName.Text = UCase(dr1(3)).ToString()
                    obj.TxtIDProof.Text = UCase(dr1(4)).ToString()
                    obj.TxtParticular.Text = UCase(dr1(5)).ToString()
                    obj.TxtLogin.Text = Me.LblTimeCabin8.Text
                    obj.txtLogout.Text = Now.ToLongTimeString.ToString
                    obj.TxtDuration.Text = Me.LblDurationCabin8.Text
                    obj.ShowDialog()
                Else
                    MessageBox.Show("This user record is deleted. Please re-enter this user information", "Record Deleted", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    EntryFrm.CBFormState.SelectedItem = "8"
                    EntryFrm.ShowDialog()
                End If
                OleCn.Close()
                dr1.Close()

            Catch ex As Exception
                MessageBox.Show(ex.Message, "User-Logout Error:", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Return
        End If

    End Sub

    Private Sub LinkLblCabin9_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLblCabin9.LinkClicked

        Try
            If Me.TimerCabin9.Enabled = False Then
                EntryFrm.CBFormState.SelectedItem = "9"
                EntryFrm.ShowDialog()
                Return
            End If
        Catch ex As Exception
        End Try

        If Me.TimerCabin9.Enabled = True Then
            Dim dr1 As OleDbDataReader
            Dim com1 As New OleDbCommand

            Try
                With OleCn
                    If .State <> ConnectionState.Open Then
                        .ConnectionString = StrConnection()
                        .Open()
                    End If
                End With
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Try
                com1.CommandText = "select [SerialNo],[CabinNo],[Dat],[CustomerName],[ID_Proof],[Particular] from Table1 where SerialNo = " & Me.TxtSnoCabin9.Text & ""
                com1.Connection = OleCn

                dr1 = com1.ExecuteReader
                If dr1.Read Then
                    ' EntryFrm.Show()
                    Dim obj As New EntryFrm2
                    obj.WindowState = FormWindowState.Normal
                    obj.CBFormState.Text = "9"
                    obj.txtSerialNo.Text = UCase(dr1(0)).ToString()
                    'obj.CBFormState.SelectedItem = dr1(1).ToString()
                    obj.txtDate.Value = UCase(dr1(2)).ToString()
                    obj.txtName.Text = UCase(dr1(3)).ToString()
                    obj.TxtIDProof.Text = UCase(dr1(4)).ToString()
                    obj.TxtParticular.Text = UCase(dr1(5)).ToString()
                    obj.TxtLogin.Text = Me.LblTimeCabin9.Text
                    obj.txtLogout.Text = Now.ToLongTimeString.ToString
                    obj.TxtDuration.Text = Me.LblDurationCabin9.Text
                    obj.ShowDialog()
                Else
                    MessageBox.Show("This user record is deleted. Please re-enter this user information", "Record Deleted", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    EntryFrm.CBFormState.SelectedItem = "9"
                    EntryFrm.ShowDialog()
                End If
                OleCn.Close()
                dr1.Close()

            Catch ex As Exception
                MessageBox.Show(ex.Message, "User-Logout Error:", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Return
        End If

    End Sub

    Private Sub LinkLblCabin10_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLblCabin10.LinkClicked

        Try
            If Me.TimerCabin10.Enabled = False Then
                EntryFrm.CBFormState.SelectedItem = "10"
                EntryFrm.ShowDialog()
                Return
            End If
        Catch ex As Exception
        End Try

        If Me.TimerCabin10.Enabled = True Then
            Dim dr1 As OleDbDataReader
            Dim com1 As New OleDbCommand

            Try
                With OleCn
                    If .State <> ConnectionState.Open Then
                        .ConnectionString = StrConnection()
                        .Open()
                    End If
                End With
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Try
                com1.CommandText = "select [SerialNo],[CabinNo],[Dat],[CustomerName],[ID_Proof],[Particular] from Table1 where SerialNo = " & Me.TxtSnoCabin10.Text & ""
                com1.Connection = OleCn

                dr1 = com1.ExecuteReader
                If dr1.Read Then
                    ' EntryFrm.Show()
                    Dim obj As New EntryFrm2
                    obj.WindowState = FormWindowState.Normal
                    obj.CBFormState.Text = "10"
                    obj.txtSerialNo.Text = UCase(dr1(0)).ToString()
                    'obj.CBFormState.SelectedItem = dr1(1).ToString()
                    obj.txtDate.Value = UCase(dr1(2)).ToString()
                    obj.txtName.Text = UCase(dr1(3)).ToString()
                    obj.TxtIDProof.Text = UCase(dr1(4)).ToString()
                    obj.TxtParticular.Text = UCase(dr1(5)).ToString()
                    obj.TxtLogin.Text = Me.LblTimeCabin10.Text
                    obj.txtLogout.Text = Now.ToLongTimeString.ToString
                    obj.TxtDuration.Text = Me.LblDurationCabin10.Text
                    obj.ShowDialog()
                Else
                    MessageBox.Show("This user record is deleted. Please re-enter this user information", "Record Deleted", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    EntryFrm.CBFormState.SelectedItem = "10"
                    EntryFrm.ShowDialog()
                End If
                OleCn.Close()
                dr1.Close()

            Catch ex As Exception
                MessageBox.Show(ex.Message, "User-Logout Error:", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Return
        End If

    End Sub

    Private Sub LinkLblCabin11_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLblCabin11.LinkClicked

        Try
            If Me.TimerCabin11.Enabled = False Then
                EntryFrm.CBFormState.SelectedItem = "11"
                EntryFrm.ShowDialog()
                Return
            End If
        Catch ex As Exception
        End Try

        If Me.TimerCabin11.Enabled = True Then
            Dim dr1 As OleDbDataReader
            Dim com1 As New OleDbCommand

            Try
                With OleCn
                    If .State <> ConnectionState.Open Then
                        .ConnectionString = StrConnection()
                        .Open()
                    End If
                End With
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Try
                com1.CommandText = "select [SerialNo],[CabinNo],[Dat],[CustomerName],[ID_Proof],[Particular] from Table1 where SerialNo = " & Me.TxtSnoCabin11.Text & ""
                com1.Connection = OleCn

                dr1 = com1.ExecuteReader
                If dr1.Read Then
                    ' EntryFrm.Show()
                    Dim obj As New EntryFrm2
                    obj.WindowState = FormWindowState.Normal
                    obj.CBFormState.Text = "11"
                    obj.txtSerialNo.Text = UCase(dr1(0)).ToString()
                    'obj.CBFormState.SelectedItem = dr1(1).ToString()
                    obj.txtDate.Value = UCase(dr1(2)).ToString()
                    obj.txtName.Text = UCase(dr1(3)).ToString()
                    obj.TxtIDProof.Text = UCase(dr1(4)).ToString()
                    obj.TxtParticular.Text = UCase(dr1(5)).ToString()
                    obj.TxtLogin.Text = Me.LblTimeCabin11.Text
                    obj.txtLogout.Text = Now.ToLongTimeString.ToString
                    obj.TxtDuration.Text = Me.LblDurationCabin11.Text
                    obj.ShowDialog()
                Else
                    MessageBox.Show("This user record is deleted. Please re-enter this user information", "Record Deleted", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    EntryFrm.CBFormState.SelectedItem = "11"
                    EntryFrm.ShowDialog()
                End If
                OleCn.Close()
                dr1.Close()

            Catch ex As Exception
                MessageBox.Show(ex.Message, "User-Logout Error:", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Return
        End If

    End Sub

    Private Sub LinkLblCabin12_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLblCabin12.LinkClicked

        Try
            If Me.TimerCabin12.Enabled = False Then
                EntryFrm.CBFormState.SelectedItem = "12"
                EntryFrm.ShowDialog()
                Return
            End If
        Catch ex As Exception
        End Try

        If Me.TimerCabin12.Enabled = True Then
            Dim dr1 As OleDbDataReader
            Dim com1 As New OleDbCommand

            Try
                With OleCn
                    If .State <> ConnectionState.Open Then
                        .ConnectionString = StrConnection()
                        .Open()
                    End If
                End With
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Try
                com1.CommandText = "select [SerialNo],[CabinNo],[Dat],[CustomerName],[ID_Proof],[Particular] from Table1 where SerialNo = " & Me.TxtSnoCabin12.Text & ""
                com1.Connection = OleCn

                dr1 = com1.ExecuteReader
                If dr1.Read Then
                    ' EntryFrm.Show()
                    Dim obj As New EntryFrm2
                    obj.WindowState = FormWindowState.Normal
                    obj.CBFormState.Text = "12"
                    obj.txtSerialNo.Text = UCase(dr1(0)).ToString()
                    'obj.CBFormState.SelectedItem = dr1(1).ToString()
                    obj.txtDate.Value = UCase(dr1(2)).ToString()
                    obj.txtName.Text = UCase(dr1(3)).ToString()
                    obj.TxtIDProof.Text = UCase(dr1(4)).ToString()
                    obj.TxtParticular.Text = UCase(dr1(5)).ToString()
                    obj.TxtLogin.Text = Me.LblTimeCabin12.Text
                    obj.txtLogout.Text = Now.ToLongTimeString.ToString
                    obj.TxtDuration.Text = Me.LblDurationCabin12.Text
                    obj.ShowDialog()
                Else
                    MessageBox.Show("This user record is deleted. Please re-enter this user information", "Record Deleted", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    EntryFrm.CBFormState.SelectedItem = "12"
                    EntryFrm.ShowDialog()
                End If
                OleCn.Close()
                dr1.Close()

            Catch ex As Exception
                MessageBox.Show(ex.Message, "User-Logout Error:", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Return
        End If

    End Sub

    Private Sub LinkLblCabin13_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLblCabin13.LinkClicked

        Try
            If Me.TimerCabin13.Enabled = False Then
                EntryFrm.CBFormState.SelectedItem = "13"
                EntryFrm.ShowDialog()
                Return
            End If
        Catch ex As Exception
        End Try

        If Me.TimerCabin13.Enabled = True Then
            Dim dr1 As OleDbDataReader
            Dim com1 As New OleDbCommand

            Try
                With OleCn
                    If .State <> ConnectionState.Open Then
                        .ConnectionString = StrConnection()
                        .Open()
                    End If
                End With
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Try
                com1.CommandText = "select [SerialNo],[CabinNo],[Dat],[CustomerName],[ID_Proof],[Particular] from Table1 where SerialNo = " & Me.TxtSnoCabin13.Text & ""
                com1.Connection = OleCn

                dr1 = com1.ExecuteReader
                If dr1.Read Then
                    ' EntryFrm.Show()
                    Dim obj As New EntryFrm2
                    obj.WindowState = FormWindowState.Normal
                    obj.CBFormState.Text = "13"
                    obj.txtSerialNo.Text = UCase(dr1(0)).ToString()
                    'obj.CBFormState.SelectedItem = dr1(1).ToString()
                    obj.txtDate.Value = UCase(dr1(2)).ToString()
                    obj.txtName.Text = UCase(dr1(3)).ToString()
                    obj.TxtIDProof.Text = UCase(dr1(4)).ToString()
                    obj.TxtParticular.Text = UCase(dr1(5)).ToString()
                    obj.TxtLogin.Text = Me.LblTimeCabin13.Text
                    obj.txtLogout.Text = Now.ToLongTimeString.ToString
                    obj.TxtDuration.Text = Me.LblDurationCabin13.Text
                    obj.ShowDialog()
                Else
                    MessageBox.Show("This user record is deleted. Please re-enter this user information", "Record Deleted", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    EntryFrm.CBFormState.SelectedItem = "13"
                    EntryFrm.ShowDialog()
                End If
                OleCn.Close()
                dr1.Close()

            Catch ex As Exception
                MessageBox.Show(ex.Message, "User-Logout Error:", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Return
        End If

    End Sub

    Private Sub LinkLblCabin14_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLblCabin14.LinkClicked

        Try
            If Me.TimerCabin14.Enabled = False Then
                EntryFrm.CBFormState.SelectedItem = "14"
                EntryFrm.ShowDialog()
                Return
            End If
        Catch ex As Exception
        End Try

        If Me.TimerCabin14.Enabled = True Then
            Dim dr1 As OleDbDataReader
            Dim com1 As New OleDbCommand

            Try
                With OleCn
                    If .State <> ConnectionState.Open Then
                        .ConnectionString = StrConnection()
                        .Open()
                    End If
                End With
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Try
                com1.CommandText = "select [SerialNo],[CabinNo],[Dat],[CustomerName],[ID_Proof],[Particular] from Table1 where SerialNo = " & Me.TxtSnoCabin14.Text & ""
                com1.Connection = OleCn

                dr1 = com1.ExecuteReader
                If dr1.Read Then
                    ' EntryFrm.Show()
                    Dim obj As New EntryFrm2
                    obj.WindowState = FormWindowState.Normal
                    obj.CBFormState.Text = "14"
                    obj.txtSerialNo.Text = UCase(dr1(0)).ToString()
                    'obj.CBFormState.SelectedItem = dr1(1).ToString()
                    obj.txtDate.Value = UCase(dr1(2)).ToString()
                    obj.txtName.Text = UCase(dr1(3)).ToString()
                    obj.TxtIDProof.Text = UCase(dr1(4)).ToString()
                    obj.TxtParticular.Text = UCase(dr1(5)).ToString()
                    obj.TxtLogin.Text = Me.LblTimeCabin14.Text
                    obj.txtLogout.Text = Now.ToLongTimeString.ToString
                    obj.TxtDuration.Text = Me.LblDurationCabin14.Text
                    obj.ShowDialog()
                Else
                    MessageBox.Show("This user record is deleted. Please re-enter this user information", "Record Deleted", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    EntryFrm.CBFormState.SelectedItem = "14"
                    EntryFrm.ShowDialog()
                End If
                OleCn.Close()
                dr1.Close()

            Catch ex As Exception
                MessageBox.Show(ex.Message, "User-Logout Error:", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Return
        End If

    End Sub

    Private Sub LinkLblCabin15_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLblCabin15.LinkClicked

        Try
            If Me.TimerCabin15.Enabled = False Then
                EntryFrm.CBFormState.SelectedItem = "15"
                EntryFrm.ShowDialog()
                Return
            End If
        Catch ex As Exception
        End Try

        If Me.TimerCabin15.Enabled = True Then
            Dim dr1 As OleDbDataReader
            Dim com1 As New OleDbCommand

            Try
                With OleCn
                    If .State <> ConnectionState.Open Then
                        .ConnectionString = StrConnection()
                        .Open()
                    End If
                End With
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Try
                com1.CommandText = "select [SerialNo],[CabinNo],[Dat],[CustomerName],[ID_Proof],[Particular] from Table1 where SerialNo = " & Me.TxtSnoCabin15.Text & ""
                com1.Connection = OleCn

                dr1 = com1.ExecuteReader
                If dr1.Read Then
                    ' EntryFrm.Show()
                    Dim obj As New EntryFrm2
                    obj.WindowState = FormWindowState.Normal
                    obj.CBFormState.Text = "15"
                    obj.txtSerialNo.Text = UCase(dr1(0)).ToString()
                    'obj.CBFormState.SelectedItem = dr1(1).ToString()
                    obj.txtDate.Value = UCase(dr1(2)).ToString()
                    obj.txtName.Text = UCase(dr1(3)).ToString()
                    obj.TxtIDProof.Text = UCase(dr1(4)).ToString()
                    obj.TxtParticular.Text = UCase(dr1(5)).ToString()
                    obj.TxtLogin.Text = Me.LblTimeCabin15.Text
                    obj.txtLogout.Text = Now.ToLongTimeString.ToString
                    obj.TxtDuration.Text = Me.LblDurationCabin15.Text
                    obj.ShowDialog()
                Else
                    MessageBox.Show("This user record is deleted. Please re-enter this user information", "Record Deleted", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    EntryFrm.CBFormState.SelectedItem = "15"
                    EntryFrm.ShowDialog()
                End If
                OleCn.Close()
                dr1.Close()

            Catch ex As Exception
                MessageBox.Show(ex.Message, "User-Logout Error:", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Return
        End If

    End Sub

    Private Sub LinkLblCabin16_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLblCabin16.LinkClicked

        Try
            If Me.TimerCabin16.Enabled = False Then
                EntryFrm.CBFormState.SelectedItem = "16"
                EntryFrm.ShowDialog()
                Return
            End If
        Catch ex As Exception
        End Try

        If Me.TimerCabin16.Enabled = True Then
            Dim dr1 As OleDbDataReader
            Dim com1 As New OleDbCommand

            Try
                With OleCn
                    If .State <> ConnectionState.Open Then
                        .ConnectionString = StrConnection()
                        .Open()
                    End If
                End With
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Try

                com1.CommandText = "select [SerialNo],[CabinNo],[Dat],[CustomerName],[ID_Proof],[Particular] from Table1 where SerialNo = " & Me.TxtSnoCabin16.Text & ""
                com1.Connection = OleCn

                dr1 = com1.ExecuteReader
                If dr1.Read Then
                    ' EntryFrm.Show()
                    Dim obj As New EntryFrm2
                    obj.WindowState = FormWindowState.Normal
                    obj.CBFormState.Text = "16"
                    obj.txtSerialNo.Text = UCase(dr1(0)).ToString()
                    'obj.CBFormState.SelectedItem = dr1(1).ToString()
                    obj.txtDate.Value = UCase(dr1(2)).ToString()
                    obj.txtName.Text = UCase(dr1(3)).ToString()
                    obj.TxtIDProof.Text = UCase(dr1(4)).ToString()
                    obj.TxtParticular.Text = UCase(dr1(5)).ToString()
                    obj.TxtLogin.Text = Me.LblTimeCabin16.Text
                    obj.txtLogout.Text = Now.ToLongTimeString.ToString
                    obj.TxtDuration.Text = Me.LblDurationCabin16.Text
                    obj.ShowDialog()
                Else
                    MessageBox.Show("This user record is deleted. Please re-enter this user information", "Record Deleted", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    EntryFrm.CBFormState.SelectedItem = "16"
                    EntryFrm.ShowDialog()
                End If
                OleCn.Close()
                dr1.Close()
            Catch ex As Exception
                MessageBox.Show(ex.Message, "User-Logout Error:", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Return
        End If

    End Sub

    Private Sub LinkLblCabin17_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLblCabin17.LinkClicked

        Try
            If Me.TimerCabin17.Enabled = False Then
                EntryFrm.CBFormState.SelectedItem = "17"
                EntryFrm.ShowDialog()
                Return
            End If
        Catch ex As Exception
        End Try

        If Me.TimerCabin17.Enabled = True Then
            Dim dr1 As OleDbDataReader
            Dim com1 As New OleDbCommand

            Try
                With OleCn
                    If .State <> ConnectionState.Open Then
                        .ConnectionString = StrConnection()
                        .Open()
                    End If
                End With
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Try
                com1.CommandText = "select [SerialNo],[CabinNo],[Dat],[CustomerName],[ID_Proof],[Particular] from Table1 where SerialNo = " & Me.TxtSnoCabin17.Text & ""
                com1.Connection = OleCn

                dr1 = com1.ExecuteReader
                If dr1.Read Then
                    ' EntryFrm.Show()
                    Dim obj As New EntryFrm2
                    obj.WindowState = FormWindowState.Normal
                    obj.CBFormState.Text = "17"
                    obj.txtSerialNo.Text = UCase(dr1(0)).ToString()
                    'obj.CBFormState.SelectedItem = dr1(1).ToString()
                    obj.txtDate.Value = UCase(dr1(2)).ToString()
                    obj.txtName.Text = UCase(dr1(3)).ToString()
                    obj.TxtIDProof.Text = UCase(dr1(4)).ToString()
                    obj.TxtParticular.Text = UCase(dr1(5)).ToString()
                    obj.TxtLogin.Text = Me.LblTimeCabin17.Text
                    obj.txtLogout.Text = Now.ToLongTimeString.ToString
                    obj.TxtDuration.Text = Me.LblDurationCabin17.Text
                    obj.ShowDialog()
                Else
                    MessageBox.Show("This user record is deleted. Please re-enter this user information", "Record Deleted", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    EntryFrm.CBFormState.SelectedItem = "17"
                    EntryFrm.ShowDialog()
                End If
                OleCn.Close()
                dr1.Close()

            Catch ex As Exception
                MessageBox.Show(ex.Message, "User-Logout Error:", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Return
        End If

    End Sub

    Private Sub LinkLblCabin18_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLblCabin18.LinkClicked

        Try
            If Me.TimerCabin18.Enabled = False Then
                EntryFrm.CBFormState.SelectedItem = "18"
                EntryFrm.ShowDialog()
                Return
            End If
        Catch ex As Exception
        End Try

        If Me.TimerCabin18.Enabled = True Then
            Dim dr1 As OleDbDataReader
            Dim com1 As New OleDbCommand

            Try
                With OleCn
                    If .State <> ConnectionState.Open Then
                        .ConnectionString = StrConnection()
                        .Open()
                    End If
                End With
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Try
                com1.CommandText = "select [SerialNo],[CabinNo],[Dat],[CustomerName],[ID_Proof],[Particular] from Table1 where SerialNo = " & Me.TxtSnoCabin18.Text & ""
                com1.Connection = OleCn

                dr1 = com1.ExecuteReader
                If dr1.Read Then
                    ' EntryFrm.Show()
                    Dim obj As New EntryFrm2
                    obj.WindowState = FormWindowState.Normal
                    obj.CBFormState.Text = "18"
                    obj.txtSerialNo.Text = UCase(dr1(0)).ToString()
                    'obj.CBFormState.SelectedItem = dr1(1).ToString()
                    obj.txtDate.Value = UCase(dr1(2)).ToString()
                    obj.txtName.Text = UCase(dr1(3)).ToString()
                    obj.TxtIDProof.Text = UCase(dr1(4)).ToString()
                    obj.TxtParticular.Text = UCase(dr1(5)).ToString()
                    obj.TxtLogin.Text = Me.LblTimeCabin18.Text
                    obj.txtLogout.Text = Now.ToLongTimeString.ToString
                    obj.TxtDuration.Text = Me.LblDurationCabin18.Text
                    obj.ShowDialog()
                Else
                    MessageBox.Show("This user record is deleted. Please re-enter this user information", "Record Deleted", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    EntryFrm.CBFormState.SelectedItem = "18"
                    EntryFrm.ShowDialog()
                End If
                OleCn.Close()
                dr1.Close()

            Catch ex As Exception
                MessageBox.Show(ex.Message, "User-Logout Error:", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Return
        End If

    End Sub

    Private Sub LinkLblCabin19_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLblCabin19.LinkClicked

        Try
            If Me.TimerCabin19.Enabled = False Then
                EntryFrm.CBFormState.SelectedItem = "19"
                EntryFrm.ShowDialog()
                Return
            End If
        Catch ex As Exception
        End Try

        If Me.TimerCabin19.Enabled = True Then
            Dim dr1 As OleDbDataReader
            Dim com1 As New OleDbCommand

            Try
                With OleCn
                    If .State <> ConnectionState.Open Then
                        .ConnectionString = StrConnection()
                        .Open()
                    End If
                End With
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Try
                com1.CommandText = "select [SerialNo],[CabinNo],[Dat],[CustomerName],[ID_Proof],[Particular] from Table1 where SerialNo = " & Me.TxtSnoCabin19.Text & ""
                com1.Connection = OleCn

                dr1 = com1.ExecuteReader
                If dr1.Read Then
                    ' EntryFrm.Show()
                    Dim obj As New EntryFrm2
                    obj.WindowState = FormWindowState.Normal
                    obj.CBFormState.Text = "19"
                    obj.txtSerialNo.Text = UCase(dr1(0)).ToString()
                    'obj.CBFormState.SelectedItem = dr1(1).ToString()
                    obj.txtDate.Value = UCase(dr1(2)).ToString()
                    obj.txtName.Text = UCase(dr1(3)).ToString()
                    obj.TxtIDProof.Text = UCase(dr1(4)).ToString()
                    obj.TxtParticular.Text = UCase(dr1(5)).ToString()
                    obj.TxtLogin.Text = Me.LblTimeCabin19.Text
                    obj.txtLogout.Text = Now.ToLongTimeString.ToString
                    obj.TxtDuration.Text = Me.LblDurationCabin19.Text
                    obj.ShowDialog()
                Else
                    MessageBox.Show("This user record is deleted. Please re-enter this user information", "Record Deleted", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    EntryFrm.CBFormState.SelectedItem = "19"
                    EntryFrm.ShowDialog()
                End If
                OleCn.Close()
                dr1.Close()

            Catch ex As Exception
                MessageBox.Show(ex.Message, "User-Logout Error:", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Return
        End If

    End Sub

    Private Sub LinkLblCabin20_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLblCabin20.LinkClicked

        Try
            If Me.TimerCabin20.Enabled = False Then
                EntryFrm.CBFormState.SelectedItem = "20"
                EntryFrm.ShowDialog()
                Return
            End If
        Catch ex As Exception
        End Try

        If Me.TimerCabin20.Enabled = True Then
            Dim dr1 As OleDbDataReader
            Dim com1 As New OleDbCommand

            Try
                With OleCn
                    If .State <> ConnectionState.Open Then
                        .ConnectionString = StrConnection()
                        .Open()
                    End If
                End With
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try


            Try
                com1.CommandText = "select [SerialNo],[CabinNo],[Dat],[CustomerName],[ID_Proof],[Particular] from Table1 where SerialNo = " & Me.TxtSnoCabin20.Text & ""
                com1.Connection = OleCn

                dr1 = com1.ExecuteReader
                If dr1.Read Then
                    ' EntryFrm.Show()
                    Dim obj As New EntryFrm2
                    obj.WindowState = FormWindowState.Normal
                    obj.CBFormState.Text = "20"
                    obj.txtSerialNo.Text = UCase(dr1(0)).ToString()
                    'obj.CBFormState.SelectedItem = dr1(1).ToString()
                    obj.txtDate.Value = UCase(dr1(2)).ToString()
                    obj.txtName.Text = UCase(dr1(3)).ToString()
                    obj.TxtIDProof.Text = UCase(dr1(4)).ToString()
                    obj.TxtParticular.Text = UCase(dr1(5)).ToString()
                    obj.TxtLogin.Text = Me.LblTimeCabin20.Text
                    obj.txtLogout.Text = Now.ToLongTimeString.ToString
                    obj.TxtDuration.Text = Me.LblDurationCabin20.Text
                    obj.ShowDialog()
                Else
                    MessageBox.Show("This user record is deleted. Please re-enter this user information", "Record Deleted", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    EntryFrm.CBFormState.SelectedItem = "20"
                    EntryFrm.ShowDialog()
                End If
                OleCn.Close()
                dr1.Close()

            Catch ex As Exception
                MessageBox.Show(ex.Message, "User-Logout Error:", MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try

            Return
        End If

    End Sub

    Private Sub TimerFrm_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        Try
            If EnabledTimer1() = True Then
                Return
            End If

        Catch ex As Exception
        End Try
       
    End Sub

    Private Sub cmdClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdClose.Click
        Try
            OleCn.Close()
            Me.Close()

        Catch ex As Exception
        End Try
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Try
            MainFrm.ShowDialog()
        Catch ex As Exception
        End Try
    End Sub
    Private Function EnabledTimer1() As Boolean
        If TimerCabin1.Enabled = True Or TimerCabin2.Enabled = True Or TimerCabin3.Enabled = True Or TimerCabin4.Enabled = True Or TimerCabin5.Enabled = True Or TimerCabin6.Enabled = True Or TimerCabin7.Enabled = True Or TimerCabin8.Enabled = True Or TimerCabin9.Enabled = True Or TimerCabin10.Enabled = True Or TimerCabin11.Enabled = True Or TimerCabin12.Enabled = True Or TimerCabin13.Enabled = True Or TimerCabin14.Enabled = True Or TimerCabin15.Enabled = True Or TimerCabin16.Enabled = True Or TimerCabin17.Enabled = True Or TimerCabin18.Enabled = True Or TimerCabin19.Enabled = True Or TimerCabin20.Enabled = True Then
            MsgBox("Please Logout all users before exit....", MsgBoxStyle.Critical, "Attention...")
            Return True
            Exit Function
        End If
    End Function

    Private Sub TimerFrm_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        e.SuppressKeyPress = e.Control
        If e.KeyCode = Keys.Enter Then
            SendKeys.Send("{tab}")
        End If
    End Sub
End Class