How to Make a Login Form in Visual Basics 2010




I am going to teach you how to make a login form in Visual Basics. These can be used for a bunch of things, such as if you are making an email program, you can keep it protected by using this, or if you are making a VB operating system, you can lock your account with this. Lets get to it!

Step 1: Creating the Form

Make a form and remove the text and change "Show Icon" to false. You don't have to disable the icon, but in my opinion, it looks much nicer without it.

Step 2: Add the Interface

Add 2 labels, 2 textboxes, and 1 button.
Change label 1's text to "Username", and label 2's text to "Password", then the button's text to "Login".

The labels will be used to mark which textbox is which. Usually, I put the username textbox on the top, and the password textbox on the bottom, mainly because most login forms use this format. The button will be used to submit the information.

Step 3: Inserting the Code...

Double click the button, and put the following code in:
If TextBox1.Text = "username" And TextBox2.Text = "password" Then Form2.ShowDialog() Else MsgBox("Sorry, The Username or Password was incorrect.", MsgBoxStyle.Critical, "Information")
(Ignore the code in the image, i was tired and wrote the wrong code, haha)

This is basically telling it that if the data entered is "username" and "password", then it needs to show Form2. It also tells it that if the data entered is anything else, to show a message saying that the information was wrong, and that the person needs to reenter it.


Go to properties for the second TextBox (or which ever textbox is your password textbox) and then change the PasswordChar to '*'. This hides your password, so that nobody can see it.

Step 4: The Finished Project

Add a second form (what the login form will lead you to when you enter the correct information), and then you are done with the login form!

If you have any questions, feel free to comment! :)



  • Tape Contest

    Tape Contest
  • Trash to Treasure

    Trash to Treasure
  • Arduino Contest 2019

    Arduino Contest 2019

11 Discussions


1 year ago

Is there a Steps on how can we make a registration Form in Visual Basic?


2 years ago

It works but the form 2 doesn't open and the error code just comes up. Help please


3 years ago

hello! thanks for the log in tutorial..

i am hoping that can you make another tutorial for the sign up form? which i can save the data.. i don't know how to do it. thank you :)


3 years ago

How are you?
Thanks for such help☺ My task is to create a health club database using VB.NET.
This is my 1st time doing this, by following you, I managed to get through the pass stage; I need extra marks like merit or distinction. In doing so, I will definitely need to add extra features and i really need your help! I just learned one from you, e.g the login page but you didn't add tutorial for the "Access".
Can you please give me list of other features that i can add to my health club?


4 years ago on Introduction

nice codes.. it helps me ....

by the way can you show me step by step how to create and add an icon???

At the time of making the tutorial, all of the code worked. Are you certain you copied it entirely? If you're using this with a newer VB, things may be different so it might not work.


4 years ago on Introduction

i have a question . how do i make an actual useable login screen . like one where a person can create his own user and password . This is for my ICT project . so would really appreciate all the help i can get. here is my email ID " ". any help can be sent to my email . Thanks :)

1 reply