Click here to Skip to main content
15,890,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
So we're having a log-in form in which the program must detect what position the user is assigned to. (selecting position is done during sign-up, so position of the user is saved into the database already). Supposedly, there is a separate form for every position.

VB
Dim username As String = txtUser.Text
Dim password As String = txtPass.Text

//check if username and password exist
 checklogin(username, password)
        If RS.EOF Then
            MessageBox.Show("Mismatch Entry", "confirmation Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Error)
            txtUser.Clear()
            txtUser.Focus()
        Else
            Me.Hide()
            //problem starts here
            checkposition()
            If (position == "Officer")
                OfficerForm.Show()
            Elseif (position == "Head")
                HeadForm.Show()
            Elseif (position == "Admin")
                AdminForm.Show()
            Else
             // dialog box
        End If
    End Sub

The method for checkposition:

VB
Public Sub checkpositon(ByVal username As String, ByVal positon As String)
    RS = CN.Execute("SELECT position FROM admin WHERE uName = '" & username & "' ")
End Sub


know there's still something missing in the code. and I know what's wrong with it. How will the position in the database be retrieved into the log-in form? PLEASE HELP :( Thank you!
Posted

1 solution

VB
Dim username As String = txtUser.Text
Dim password As String = txtPass.Text
 
//check if username and password exist
 checklogin(username, password)
        If RS.EOF Then
            MessageBox.Show("Mismatch Entry", "confirmation Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Error)
            txtUser.Clear()
            txtUser.Focus()
        Else
            Me.Hide()
            //problem starts here
            checkposition()
            If (position = "Officer")
                OfficerForm.Show()
            Elseif (position = "Head")
                HeadForm.Show()
            Elseif (position = "Admin")
                AdminForm.Show()
            Else
             // dialog box
        End If
    End Sub
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900