Simple Login / Security in VB 6.0
9:31 PM
| Posted by
Unknown
|
SCREENSHOT
CODE
Option Explicit
Dim user As String
Dim pass As String
Public LoginSucceeded As Boolean
Private Sub cmdExit_Click()
If MsgBox("Are you sure to close this Application?", vbQuestion + vbYesNo, "System") = vbYes Then
End
End If
End Sub
Private Sub cmdLogin_Click()
user = "admin"
pass = "12345"
If txtUserName.Text = user Then
If txtPassword.Text = pass Then
MsgBox "Username and Password Accepted!", vbInformation, "Login"
'You may change this line here. call the form rather than displaying a message box!
ElseIf txtPassword.Text = "" Then
MsgBox "Password Field Empty!", vbExclamation, "Login"
Else
MsgBox "Username and Password not Matched!", vbExclamation, "Login"
End If
ElseIf txtUserName.Text = "" Then
MsgBox "Username Field Empty!", vbExclamation, "Login"
Else
MsgBox "Invalid Username, try again!", , "Login"
txtPassword.SetFocus
End If
End Sub
DOWNLOAD HERE: Simple Login / Security in VB 6.0
CODE
Option Explicit
Dim user As String
Dim pass As String
Public LoginSucceeded As Boolean
Private Sub cmdExit_Click()
If MsgBox("Are you sure to close this Application?", vbQuestion + vbYesNo, "System") = vbYes Then
End
End If
End Sub
Private Sub cmdLogin_Click()
user = "admin"
pass = "12345"
If txtUserName.Text = user Then
If txtPassword.Text = pass Then
MsgBox "Username and Password Accepted!", vbInformation, "Login"
'You may change this line here. call the form rather than displaying a message box!
ElseIf txtPassword.Text = "" Then
MsgBox "Password Field Empty!", vbExclamation, "Login"
Else
MsgBox "Username and Password not Matched!", vbExclamation, "Login"
End If
ElseIf txtUserName.Text = "" Then
MsgBox "Username Field Empty!", vbExclamation, "Login"
Else
MsgBox "Invalid Username, try again!", , "Login"
txtPassword.SetFocus
End If
End Sub
DOWNLOAD HERE: Simple Login / Security in VB 6.0
Labels:VB 6.0 Sample Program