This document contains code for a login form. It checks the username and password entered against predefined credentials. If correct, it welcomes the user. If incorrect, it tracks the number of login attempts and alerts the user if they exceed 3 attempts, at which point it closes the form.
This document contains code for a login form. It checks the username and password entered against predefined credentials. If correct, it welcomes the user. If incorrect, it tracks the number of login attempts and alerts the user if they exceed 3 attempts, at which point it closes the form.
This document contains code for a login form. It checks the username and password entered against predefined credentials. If correct, it welcomes the user. If incorrect, it tracks the number of login attempts and alerts the user if they exceed 3 attempts, at which point it closes the form.
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