hey guys..
im really new at using vb.net and i have been set a assignment to design a cashpoint machine.
i need an error message to appear when the account number is entered incorrecly, for example error reading card, and i need a error message to appear when user entered incorrect pin number, however the user is allowed three tries before account is blocked. i have managed the following code, however when the user enters an incorrect account number or pin number both the error messages display rather than the one relating to the incorrect entry..
heres my code
Private Sub EnterButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EnterButton.Click
'set the pin to only three tries
pinTries = pinTries + 1
Dim temp As String
Dim found As Boolean
found = True
Dim aID As String
Dim correct As Boolean
correct = True
While objDR.Read()
'enter both correct pin and account ID to gain access to account details
If cashpointscreen.Text = objDR.GetString(4) And accountID.Text = objDR.GetString(0) Then
Screen.Enabled = True
Screen.Visible = True
found = False
correct = False
'Else
'found = True
'correct = False
End If
End While
'If correct = True Then
'aID = "Error reading card"
'MessageBox.Show(aID)
'End If
'If found = True Then
'temp = "You have entered your pin incorrectly " & pinTries & " times"
'MessageBox.Show(temp)
'cashpointscreen.Clear()
'End If
If pinTries = 3 Then
'message box telling user they have entered pin incorrect three times
MessageBox.Show("You Have Entered your pin incorrect 3 times - your account will now be blocked")
'disable the box so user cannot attempt to enter pin again
EnterButton.Enabled = False
EnterButton.Visible = False
'cashpointscreen.Clear()
End If
im really stuck and i have been working on it for weeks. if anyone has any ideas i would love the advice!
thanks!
im really new at using vb.net and i have been set a assignment to design a cashpoint machine.
i need an error message to appear when the account number is entered incorrecly, for example error reading card, and i need a error message to appear when user entered incorrect pin number, however the user is allowed three tries before account is blocked. i have managed the following code, however when the user enters an incorrect account number or pin number both the error messages display rather than the one relating to the incorrect entry..
heres my code
Private Sub EnterButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EnterButton.Click
'set the pin to only three tries
pinTries = pinTries + 1
Dim temp As String
Dim found As Boolean
found = True
Dim aID As String
Dim correct As Boolean
correct = True
While objDR.Read()
'enter both correct pin and account ID to gain access to account details
If cashpointscreen.Text = objDR.GetString(4) And accountID.Text = objDR.GetString(0) Then
Screen.Enabled = True
Screen.Visible = True
found = False
correct = False
'Else
'found = True
'correct = False
End If
End While
'If correct = True Then
'aID = "Error reading card"
'MessageBox.Show(aID)
'End If
'If found = True Then
'temp = "You have entered your pin incorrectly " & pinTries & " times"
'MessageBox.Show(temp)
'cashpointscreen.Clear()
'End If
If pinTries = 3 Then
'message box telling user they have entered pin incorrect three times
MessageBox.Show("You Have Entered your pin incorrect 3 times - your account will now be blocked")
'disable the box so user cannot attempt to enter pin again
EnterButton.Enabled = False
EnterButton.Visible = False
'cashpointscreen.Clear()
End If
im really stuck and i have been working on it for weeks. if anyone has any ideas i would love the advice!
thanks!