..
Contoh Program Password sederhana
menggunakan VB6
Buatlah Desain Form Dengan Objek2 Berikut Ini : =============================================== 2 Objek Label : Label Pertama = Name : Label1, Caption : Nama User Label Kedua = Name : Label2, Caption : Password User =============================================== 2 Objek TextBox : TextBox Pertama = Name : Text1, Text : <Kosong> TextBox Kedua = Name : Text2, Text : <Kosong>, Password Char : * =============================================== 2 Objek CommandButton : CommandButton Pertama = Name : cmdLogin, Caption : Login CommandButton Kedua = Name : cmdSignUp, Caption : Sign Up =============================================== Lalu Copy-Paste Code di Bawah ini, 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, "Chocho Rezpector" Else MsgBox "Login Gagal", vbInformation, "Chocho Rezpector" 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
Selamat Mencoba ...
|
0 komentar:
Posting Komentar