Login System without database in Visual Basic 6

Login System
Login System

Login System without database in Visual Basic 6

This is just a simple tutorial in Visual Basic 6 that demonstrates on how to create a simple login system without using a database.

This tutorial is intended for beginners who want to study Visual Basic 6. To others who are not fun of Visual Basic 6 don’t worry we’re also going to publish tutorials in different programming languages such as Java, PHP, C# and VB.net.

Let’s get started in the tutorial:

1. Open your visual basic 6. Create a new project and select Standard EXE.

2. Add a Form and name it as LoginFrm.

3. What are the objects we need? We need two Textbox, one for the username and another for the password. We also need a Command Button and two Labels.

4. Name the first Textbox into txtusername and the other Textbox into txtpassword. Name the Command Button into cmdOK and label it as OK.

The form should be like the image below:

Login Form
Login Form

5. Password (txtpassword) field should not display the actual characters that are being typed or encoded by the user. Textbox has a property of PasswordChar, it is set blank as default. To be able to hide or not to display the actual characters in the Textbox just place (*) asterisks or whatever character you want in the PasswordChar property of the Textbox. Instead of displaying the actual characters, the value you have put in the PasswordChar will be the character that will be displayed in the Textbox.

6. Let’s proceed to the coding part. Kindly add the code below in the click event of our command button (cmdOK).

If txtusername.Text = "admin" And txtpassword.Text = "admin" Then
MsgBox "Access Granted!", vbInformation, ""
MsgBox "Incorrect username or password. Kindly check it again", vbCritical, ""
End If

The code above states that if the value of the txtusername and txtpassword is admin then the system will prompt a message (Access Granted) if not, then (Incorrect username or password. Kindly check it again) message will be prompted.

7. Set the startup object of the project. Click Project in the menu bar and click Project1 Properties, a dialog box will appear, in the Startup Object, kindly select LoginFrm in the dropdown menu and click OK.

8. Run the project by pressing F5.

Hope you enjoy our simple login system without database tutorial.

Your comments and suggestions are highly appreciated.

More Visual Basic 6 Tutorials to come.



, , , , ,

Post navigation

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.