3rd Share for Visual Basic

Keep on the third application

In this application I’d like to share you about login application. Here is just the simple one. Which is if username and password is matched with the list (already define before). So, it will show message box that success to login. On the other case, it will show message box that is wrong user name or password

Here is the interface view

here is the source code


Public Class Form1

 

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btreset.Click

txtpass.Text = ""

txtuser.Text = ""

txtpass.Focus()

End Sub

 

Private Sub btcancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btcancel.Click

Dim autentikasi As Boolean

autentikasi = MessageBox.Show("Apakah Anda Yakin Keluar ?", "Informasi", MessageBoxButtons.YesNo, MessageBoxIcon.Question)

If autentikasi = True Then

Close()

Else

 

End If

End Sub

 

Private Sub btlogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btlogin.Click

Dim user As String

Dim pass As String

user = "admin"

pass = "administrator"

If (user = txtuser.Text And pass = txtpass.Text) Then

MessageBox.Show("Selamat Anda Berhasil Masuk Sistem", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)

Else

MessageBox.Show("User Name atau Password Salah", "Informasi", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly)

End If

End Sub

 

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

txtpass.Focus()

End Sub

End Class

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

%d bloggers like this: