Login System

This program is written in Visual Basic 6.

There are many windows programs which have login systems. Those programs are also called multi-user applications. So it's important to learn how to make a login system. Though its simple, its important to learn. You generally enter a valid username and password to enter the system. The username and password  are generally saved in the database but as you haven't learnt the database lessons in this tutorial, the database technique has not been used for this program. This windows program is just a demo, any database has not been used here.

If the username and password are correct then you're redirected to the main form whereas it shows an error message when you enter incorrect data. It also notifies you with a message box when either of the textboxes or both are empty.


                                                              >> DOWNLOAD 



Screenshot:
Login form



The Welcome form, main window





Code:
Private Sub cmdLogin_Click()
    If txtUsername.Text = "" Then
        MsgBox "Enter the Username!", vbExclamation, ""
        Exit Sub
    End If
   
     If txtPassword.Text = "" Then
        MsgBox "Enter the Password!", vbExclamation, ""
        Exit Sub
    End If
   
    If txtUsername.Text = "Basic32" And txtPassword.Text = "54321" _

 Then
        frmMain.Show
        Unload Me
    Else
        MsgBox "Username or Password, or both are wrong!", _

vbExclamation, ""
    End If
End Sub