Membuat Form Login di Visual Basic

Jumat, 03 Januari 2014 0 comments

Cara Membuat Form Login
1.       Pada Form FormLogin inilah masukan 1 Label, 2 Text, 1 Command, 1 Picture selanjutnya atur Properties dan Pengaturan yang sudah dibuat pada Form FormLogin

Objek
Properties
Pengaturan
Label1
Name
Caption
Backstyle
Label1
Batal
0 - Transparent
Command1
Name
Caption
Command1
LOGIN
TxtUser
Name
Caption
TxtUser
-
TxtPass
Name
Caption
TxtPass
-
Picture1
Name
Picture1



Script Form Login

Private Sub Command1_Click()
On Error Resume Next

Static i As Integer

If txtUser.Text = "" Then
GoSub noacc
MsgBox "Anda belum memasukkan Nama", vbInformation + vbOKOnly, ":: Informasi ::"
txtUser.SetFocus

ElseIf txtPass.Text = "" Then
GoSub noacc
MsgBox "Anda belum memasukkan Kata Sandi", vbInformation + vbOKOnly, ":: Informasi ::"
txtPass.SetFocus

Else
StrSQL = "SELECT * FROM login WHERE username='" & txtUser.Text & "'"
Set Rs = conn.Execute(StrSQL)

If Rs.EOF Then
GoSub noacc
MsgBox "Nama atau Kata sandi yang anda masukkan salah", vbInformation + vbOKOnly, ":: Informasi ::"
txtUser.SetFocus
ElseIf txtPass.Text <> Rs("password") Then
GoSub noacc
MsgBox "Kata sandi yang anda masukkan salah", vbInformation + vbOKOnly, ":: Informasi ::"
txtUser.SetFocus
Else
MsgBox "Selamat anda berhasil login sebagai admin", vbInformation + vbOKOnly, "Informasi"
FormMenu.Show
Unload Me
End If
Exit Sub

noacc:
i = i + 1
If i = 3 Then
MsgBox "Maaf anda tidak berhak mengakses aplikasi ini !", vbCritical, ":: Gagal ::"
End
Else
Return
End If
End If

End Sub

Private Sub Form_Load()
Call Konek
txtUser.Text = ""
txtPass.Text = ""

End Sub


Private Sub lblRegister_Click()
FrmRegister.Show
Unload Me
End Sub


Private Sub Label1_Click()
Unload Me
FormCek.Show
End Sub


0 comments:

Posting Komentar

THANX.. :)

 

©Yesi Widiawanti | Universitas Pakuan | Computer Sciense 2013 | NPM : 0651-13-200