Create Login Form VB 6.0

1:48:00 PM
In this steps, we call Step 5, before learn in this step, you must follow :
Step 1 : Cteate New Project
Step 2 : Create Main Form Application
Step 3 : Create Database and Tables
Step 4 : Create Connection Database Use Module

Open your latest Project :


Double Click Belajar VB
Below for your latest Proeject in Step 4 :

Click Project
Add Form
Click Open
Change name form be : LoginForm

and then please make below design in LoginForm


in Login form please fill below code :

Sub EnableMenu()
FormMainMenu.MenuLogin.Enabled = False
FormMainMenu.MenuLogout.Enabled = True
FormMainMenu.MenuMaster.Enabled = True
FormMainMenu.MenuTransaction.Enabled = True
FormMainMenu.MenuReport.Enabled = True
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Activate()
Text1 = ""
Text2 = ""
Text2.Enabled = False
End Sub
Sub Form_Load()
    Call OpenDB
    Text1.MaxLength = 20
    Text2.MaxLength = 20
    Text2.PasswordChar = "X"
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
    KeyAscii = Asc(UCase(Chr(KeyAscii)))
    If KeyAscii = 13 Then
        Call OpenDB
        Call SearchData
                If RSUsers.EOF Then
                    MsgBox "User not found, Please try again"
                    Text1 = ""
                Else
                Text1.Enabled = False
                Text2.Enabled = True
                Text2.SetFocus
                End If
    End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
    KeyAscii = Asc(UCase(Chr(KeyAscii)))
    If KeyAscii = 13 Then
        Command1.SetFocus
    End If
End Sub
Function SearchData()
    Call OpenDB
    RSUsers.Open "Select * From Users where User_Name='" & Text1 & "'", ConnectDB
End Function
Private Sub Command1_Click()
Dim User_Id As String
Dim NamaAdmin As String
Call OpenDB
        RSUsers.Open "Select * from Users where User_Name ='" & Text1 & "' and User_Password='" & Text2 & "'", ConnectDB
        If RSUsers.EOF Then
            MsgBox "Wrong Password, Please try again!"
            Text2 = ""
            Text2.SetFocus
        Else
            Unload Me
            FormMainMenu.Show
            Call EnableMenu
        End If
End Sub
Don't forget to fill below code in MainForm.

Sub DisableMenu()
MenuLogin.Enabled = True
MenuLogout = False
MenuMaster.Enabled = False
MenuTransaction.Enabled = False
MenuReport.Enabled = False
End Sub
Private Sub Form_Load()
Call DisableMenu
End Sub
Private Sub MenuExit_Click()
End
End Sub
Private Sub MenuLogin_Click()
LoginForm.Show vbModal
End Sub

In this Step, you can Download Just Click THIS LINK
Lets see next steps :)

Artikel Terkait

Next Article
« Prev Post
Previous Article
Next Post »
Penulisan markup di komentar
  • Untuk menulis huruf bold silahkan gunakan <strong></strong> atau <b></b>.
  • Untuk menulis huruf italic silahkan gunakan <em></em> atau <i></i>.
  • Untuk menulis huruf underline silahkan gunakan <u></u>.
  • Untuk menulis huruf strikethrought silahkan gunakan <strike></strike>.
  • Untuk menulis kode HTML silahkan gunakan <code></code> atau <pre></pre> atau <pre><code></code></pre>, dan silahkan parse dulu kodenya pada kotak parser di bawah ini.
Konversi Code
Disqus
Silahkan Berkomentar Dengan