Create a Login System with Visual Basic

Dim userName As String 'this stores the user name
Dim password As String 'this stores the password
Dim retry As Integer ' this stores the retry attemps
Dim process As Boolean 'this stores the process enabled or disabled
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles btnlogin.Click

userName = txtUser.Text
password = txtpassword.Text
process = True
retry = retry + 1

While process = True

If userName = "John" And password = "bluesky" Then

lblmessage.Text = "Welome " & userName
process = False

MsgBox("Wrong Information, Please try again")
process = False

End If
If retry = 5 Then

btnlogin.Enabled = False
MsgBox("Sorry your account is locked out")

End If

End While
End Sub

Comments are closed.