Kamis, 28 November 2013

Contoh Program Password sederhana menggunakan VB6


Nama : Rio Seiawan
Nim : 0961123
Nama : Christian Andre
Nim: 0961


Contoh Program Password sederhana menggunakan VB6

BuatlahDesain Form Dengan Objek2 BerikutIni :
===============================================
2 Objek Label :
Label Pertama = Name : Label1, Caption : Nama User
Label Kedua = Name : Label2, Caption : Password User
===============================================
2 ObjekTextBox :
TextBoxPertama = Name : Text1, Text : <Kosong>
TextBoxKedua = Name : Text2, Text : <Kosong>, Password Char : *
===============================================
2 ObjekCommandButton :
CommandButtonPertama = Name : cmdLogin, Caption : Login
CommandButtonKedua = Name : cmdSignUp, Caption : Sign Up
===============================================



















SepertiGambar Di atas

Lalu Copy-Paste Code di Bawahini, dengan Cara Klik 2x Form :

Dim NmUser, PassUser As String

Private Sub Form_Load()
On Error Resume Next
Open app.Path& "\dBase.txt" For Input As #1
Line Input #1, NmUser
Line Input #1, PassUser
Close #1

cmdLogin.Enabled = False
End Sub

Private Sub cmdLogin_Click()
On Error Resume Next
Open app.Path& "\dBase.txt" For Input As #1
Line Input #1, NmUser
Line Input #1, PassUser
Close #1

If Text1.Text = NmUser And Text2.Text = PassUser Then
MsgBox "Login Berhasil", vbInformation, "ChochoRezpector"
Else
MsgBox "Login Gagal", vbInformation, "ChochoRezpector"
End If
End Sub

Private Sub cmdSignUp_Click()
On Error Resume Next
Open app.Path& "\dBase.txt" For Output As #1
Print #1, Text1.Text
Print #1, Text2.Text
Close #1

cmdLogin.Enabled = True
cmdSignUp.Enabled = False
End Sub


Setelah itu tekan tombol  F5







                          

Tidak ada komentar:

Posting Komentar