How to create a Login Form with VB.Net 2010

Join with Elance for online Freelance Jobs

How to create a Login Form with VB.Net 2010

This tutorial show you that how we create a nice looking system login Form with encrypted password using Microsoft Visual Studio 2010. This coding will explain you some advance technique which we can use a encrypted passwords, Host name monitoring facility including capturing IP address of the person who log in to the system. 

Lets Start.

Firstly you would need followings to complete this project.

1. Visual Basic.Net 2010 Professional
2. Microsoft SQL Express 2008 R2
3. Microsoft SQL Server Management Studio 2008

First open Microsoft Visual Basic 2010 and choose a New Project. Add a new form to the project and name it as frmLoginForm.vb as shown picture below.

Drag 2 text box and 2 command buttons and place it nicely as shown in the picture. I have choose a background image for the form and have set the Transparent backgrounds as Grey color.

We would need 3 data tables.

1. Table for user names and passwords and access levels
2. Table for login activities.
3. Table for store blocked host names.

Lets start making tables. 3 create tables  as shown below. You can make 3 table  using

Microsoft SQL Server Management Studio 2008. The table structure will be as bellow images.

Table UMaster

Table BlockedHost

Table UserLogDetail

Now you have created required 3 tables and you need to create a data connection to the database. I have made a data connection link in the project properties.

Once you create the data connection, system can always identify what is the SQL server name which we need to look at the tables what we need for the project. Lets start taking required tables into the project. For this I have made some data sources in the form as below image.

Now you have done all required action to link tables into the form. Lets start coding the project. First just click on the blank form and we need to write following codes.

If you examine the above codes, you will identify that there are 2 functions to encrypt the password and also another function to decrypt the password when we need to compare when the user login to the system. The 3rd Sub function is to fill data from the server to the data sources that we created in the previous section.

Next step will be the importune part of the sample. When user need to login to the system, we will compare the user name and password with the data we have already stored in the server and if the user is attepting to try password more than 3 times, we will block the PC name until the administration unlock the Host Name. This will ensure that unauthorized users will not attempt login to the system since they get blocked by the system.

Lets examine the coding when user click the login button. I will explain you step by step how we coding it.

I am importing following namespaces and also creating 2 public parameters to monitor login attempts and Host IP address.

The below codes are checking if this Host PC has already blacklisted in the system. Also if they not found then again system will blacklist the Host Name, if user tried more than 3 times and add Host PC details to the BlcokedHosts table.

Following coding will encrypt the password which user has entered and then compare with the stored password. System will search users to match with the provided information.

If the system found any records match with the entered data, that proves that user has entered correct login information. Then system will publically store the access level which administrator has allocated for the particular logged user.

Wow, Now wee have done everything. Lets run the main form. We can enable all menus. We can add a record to UserLogedDetails table to keep a track of login activity. Also following coding will identify Host IP and it will display in a right panel.

You have done everything. Lets have a look after we successfully login to the system.

If you need full set of codes, Please click download button on the top or comments here I will email you.


How to Configure SQL 2008 work with a Static IP

Work at Home and Earn more than 100 USD monthly.


  1. Thanks, can you make download link available or email the codes to me

  2. Thank you, can you email the code to me (

  3. Great !!!!

    Can you please send me the code (djpanto.register [at]

    Thank you in advance!

  4. please send to my email

  5. Thanks, can you make download link available or email the codes to me