Visual Basic Build a login screen which will be passed an id and password. If th
ID: 3807541 • Letter: V
Question
Visual Basic
Build a login screen which will be passed an id and password. If the user fails to login in three tries, have them authentic based on their personal information. Authentic their mother's maiden name if they fail terminate the program after a message box stating their have failed to authenticate. If they succeed, ask them for the name of their first pet. If they fail, terminate the program. if successful, ask them to enter a new password twice, if they passwords match have them attempt to login. If they fail three times terminate the program.
This program should call at least 5 functions from various events.
Explanation / Answer
I'm using Visual Basic 6.
Dim question(2) As String
Dim uid As String
Dim pwd As String
Dim c As Integer
Private Sub Form_Load()
uid = "newuser"
pwd = "password"
question(1) = "Supriya Patra"
question(2) = "Bitu"
c = 0
End Sub
Private Sub login_Click()
'Checking for valid credentials.
If uid = userid.Text And pwd = password.Text Then
home.Show
Unload Me
Else
c = c + 1
'Checking for number of tries.
If c = 3 Then
Frame1.Visible = True
questions.Visible = True
c = 0
End If
'Showing message.
Label7.Visible = True
userid.Text = ""
password.Text = ""
userid.SetFocus
End If
End Sub
Private Sub qlogin1_Click()
'Checking for first question.
If ans1.Text = question(1) Then
Frame2.Visible = True
Frame1.Visible = False
Else
'Showing message in message box and then terminating.
MsgBox "Cannot authenticate user.", vbOKOnly, vbCritical
Unload Me
End If
End Sub
Private Sub qlogin2_Click()
'For second question.
If ans2.Text = question(2) Then
Frame2.Visible = False
Frame3.Visible = True
Else
MsgBox "Cannot authenticate user.", vbOKOnly, vbCritical
Unload Me
End If
End Sub
Private Sub reset_Click()
'For password reset.
If np1.Text = np2.Text Then
home.Show
Unload Me
Else
c = c + 1
Label6.Visible = True
np1.Text = ""
np2.Text = ""
np1.SetFocus
If c = 3 Then
MsgBox "Cannot authenticate user.", vbOKOnly, vbCritical
Unload Me
End If
End If
End Sub
You can get the project from the following link:
https://drive.google.com/open?id=0B-wCyuB1jOs7NWFTaVMxTDZUZ0k
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.