Imports System.Data.OleDb
Public Class cashierlogin
    Dim ctr As Integer
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Form1.Show()
        Me.Hide()
    End Sub

    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub cashierlogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Ctl3dPushButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

  
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        conn = New OleDbConnection(cn)
        Try
            conn.Open()
            str = "Select UserName, Password from TblUser where UserName = '" & Trim(txtUserName.Text) & "' and Password = '" & Trim(txtPassword.Text) & "'  and AccessLevel = 'cashier'"
            cmd = New OleDbCommand(str, conn)
            dr = cmd.ExecuteReader
            If dr.HasRows = True Then

                AboutGym.Show()
                Me.Hide()

            ElseIf txtUserName.Text = "" Or txtPassword.Text = "" Then
                MsgBox("Enter Value!")
                txtUserName.Text = ""
                ctr = ctr - 1
                If ctr = 0 Then
                    MessageBox.Show("Hacker's not allowed! End!")
                    End
                End If
            Else
                MsgBox("Invalid UserName/Password")
                txtUserName.Text = ""
                txtPassword.Text = ""
                txtUserName.Focus()
                ctr = ctr - 1
                If ctr = 0 Then
                    MessageBox.Show("Hacker's not allowed! End!")
                    End
                End If
            End If
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        dr.Close()
        conn.Close()
    End Sub

    Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.Hide()
        Form1.Show()
    End Sub
End Class