This code defines a login form with two text boxes for a username and password. When the submit button is clicked, it checks if the text in the boxes matches the hardcoded credentials, and displays a message letting the user know if the login succeeded or failed. If the login fails 3 times, it displays an access denied message and exits the application.
This code defines a login form with two text boxes for a username and password. When the submit button is clicked, it checks if the text in the boxes matches the hardcoded credentials, and displays a message letting the user know if the login succeeded or failed. If the login fails 3 times, it displays an access denied message and exits the application.
This code defines a login form with two text boxes for a username and password. When the submit button is clicked, it checks if the text in the boxes matches the hardcoded credentials, and displays a message letting the user know if the login succeeded or failed. If the login fails 3 times, it displays an access denied message and exits the application.
Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles
Button2.Click Application.Exit() End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles
Button1.Click If TextBox1.Text = "Username" And TextBox2.Text = "Password" Then MessageBox.Show("The ID and Password are correct.", "", MessageBoxButtons.OK) Application.Exit()
ElseIf TextBox1.Text = "Username" And TextBox2.Text <> "Password" Then
MessageBox.Show("The ID is correct but the password is incorrect.", "", MessageBoxButtons.OK) Denied = Denied + 1 TextBox1.Text = ""
ElseIf TextBox1.Text <> "Username" And TextBox2.Text = "Password" Then
MessageBox.Show("The ID is incorrect but the password is correct.", "", MessageBoxButtons.OK) Denied = Denied + 1 TextBox2.Text = ""
ElseIf TextBox1.Text <> "Username" And TextBox2.Text <> "Password" Then
MessageBox.Show("The ID and the password are incorrect.", "", MessageBoxButtons.OK) Denied = Denied + 1 TextBox1.Text = "" TextBox2.Text = "" End If
If Denied = 3 Then MessageBox.Show("Sorry... Access denied.", "", MessageBoxButtons.OK) Application.Exit() End If End Sub End Class