You are on page 1of 1

Public Class Form1

Dim attempt As Integer = 1

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles


Button1.Click
Dim username, password As String
username = TextBox1.Text
password = TextBox2.Text
If username = "User" And password = "Password" Then
MsgBox("Welcome Admin")
TextBox1.Clear()
TextBox2.Clear()
MainForm.Show()
Me.Hide()
ElseIf username = "User2" And password = "Password2" Then
MsgBox("Welcome Staffs")
TextBox1.Clear()
TextBox2.Clear()
MainForm.Show()
Me.Hide()
ElseIf attempt = 3 Then
MsgBox("Maximum number of attempts(3), program will now close")
Close()
Else
MsgBox("Username and Password Incorrect, Please Re-enter, You Currently
Have Reached Attempt " & attempt & " Out Of 3.")
attempt = attempt + 1
TextBox1.Text = ""
TextBox2.Text = ""
TextBox1.Focus()

End If
End Sub

You might also like