Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Public Class Form1

Dim loginattempts As Integer


Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles btnCancel.Click
Close()
End Sub
Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles btnOK.Click
If txtID.Text = "Jacob" Or "school" And txtPassword.Text = "aguynamedjacob" Then
MessageBox.Show("Welcome Jacob!", "Welcome")
txtID.Clear()
txtPassword.Clear()
ElseIf txtID.Text <> "Jacob" And txtPassword.Text <> "aguynamedjacob" Then
MessageBox.Show("Incorrect ID and Password", "Error!")
txtID.Clear()
txtPassword.Clear()
loginattempts += 1
ElseIf txtID.Text <> "Jacob" And txtPassword.Text = "aguynamedjacob" Then
MessageBox.Show("Incorrect ID", "Error")
txtID.Clear()
loginattempts += 1
ElseIf txtID.Text = "Jacob" And txtPassword.Text <> "aguynamedjacob" Then
MessageBox.Show("Incorrect Password", "Error")
txtPassword.Clear()
loginattempts += 1
End If
If loginattempts = 3 Then
MessageBox.Show("Sorry, Access denied", "Error")
Close()
End If
End Sub
End Class

You might also like