Create a Login System with Visual Basic
- Subject: Visual Basic Tutorials
- Learning Time: 2 hours
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
Else
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
Pages: 1 2