loading

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.

Optional:

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! :)

<p>It works but the form 2 doesn't open and the error code just comes up. Help please</p>
<p>i made it :)</p><p>thanks :)</p>
<p>hello! thanks for the log in tutorial..</p><p>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 :)</p>
How are you? <br>Thanks for such help☺ My task is to create a health club database using VB.NET. <br>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 &quot;Access&quot;.<br>Can you please give me list of other features that i can add to my health club?
<p>friends who need windows key can click here <a href="https://www.facebook.com/Windows-7-Professional-406869716183210" rel="nofollow">https://www.facebook.com/Windows-7-Professional-40...</a></p>
<p> nice codes.. it helps me .... </p><p>by the way can you show me step by step how to create and add an icon??? </p>
<p>did not open the login form opened form</p>
<p>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.</p>
<p>Great code! I love it!</p>
<p>Thanks! Its doing quite well for something I made when I was twelve haha</p>
<p>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 &quot;andrewtrow@gmail.com &quot;. any help can be sent to my email . Thanks :)</p>
<p>Hello! Sorry for the late response. I haven't used VB in a very long time, so I'm not sure. Sorry!</p>

About This Instructable

169,725views

9favorites

License:

More by farmerboyk:How to grow apple trees from seed . How to make a login form in Visual Basics 2010 
Add instructable to: