Tutorial Visual Basic-make simple log in

Berikut source code nya semoga bermanfaat bagi kalian yang membaca
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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s