Imports System.Data.OleDb
Public Class Login

    Private dbc As New OleDbConnection(conStr)

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



    End Sub

    Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim incmd As New OleDbCommand("DELETE * FROM tbStocks WHERE Quantity=0;", dbc)
        dbc.Open()
        incmd.ExecuteNonQuery()
        dbc.Close()


        Dim dba As New OleDbDataAdapter("SELECT Username,UserPass FROM tbLogIn", dbc)
        Dim dbset As New DataSet
        dba.Fill(dbset)

    End Sub

    Private Sub Label3_Click(sender As Object, e As EventArgs)

    End Sub

    Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
        Dim log As New OleDbDataAdapter("SELECT Description FROM tbLogIn WHERE Username='" & Me.TextBox2.Text & "' AND UserPass='" & Me.TextBox1.Text & "';", dbc)
        Dim ds As New DataSet
        log.Fill(ds)


        If ds.Tables(0).DefaultView.Count > 0 And Me.TextBox2.Text = "Admin" Then
            AdminForm.TextBox5.Text = "Manager"
            AdminForm.Show()
            Me.Hide()
        ElseIf ds.Tables(0).DefaultView.Count > 0 And Me.TextBox2.Text = "Clerk" Then
            frmMain.TextBox4.Text = "Employee"
            frmMain.Show()
            Me.Hide()
        Else
            MessageBox.Show("Incorrect Username and/or Password", "LOG IN", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Exit Sub

        End If





        'If Me.TextBox2.Text = "Clerk" And Me.TextBox1.Text = "panal" Then

        '    frmMain.TextBox4.Text = "Employee"
        '    frmMain.Show()
        '    Me.Hide()
        'ElseIf Me.TextBox2.Text = "Admin" And Me.TextBox1.Text = "bernal" Then
        '    AdminForm.TextBox5.Text = "Manager"
        '    AdminForm.Show()
        '    Me.Hide()

        'Else
        '    MessageBox.Show("Incorrect Username and/or Password", "LOG IN", MessageBoxButtons.OK, MessageBoxIcon.Information)
        '    Exit Sub


        'End If
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        UserManual.Show()

    End Sub
End Class