Login Form is a process where a user or individual can access to a computer system by identifying and authenticating of themselves. Login Form also serves as the security of the system that prevents or detect all of the actions of an unauthorized user. Today I will teach you how to create a simple Login Form so let’s get started.
- First is open the Visual Basic, Select File on the menu, then click New and create a new project.
- Then a New Project Dialog will appear. Set the name of the form to” Login Form” After that click OK.
Next, Design your simple login form just like this what I’ve shown you below.
- Add a 2 Label, 2 Textbox, and a Button from the toolbox.
Change the text of the first label into “Username” and the second label to “Password” Change also the Text of the Button to “Log in”.
Then click Textbox2 then go to Properties and select PasswordChar and select any character or symbol to display when you are about to type a password.
- After designing your form, go to Solution Explorer and right click your project then click Add and select Windows Form.
- A New Project Dialog will appear just click OK.
- Design your Form2 like this one I’ve shown you below.
- Then go back to Login Form and click the Login Button and add this following codes.
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- If TextBox1.Text = "admin" And TextBox2.Text = "admin" Then
- MsgBox("Log in Successfully!", MsgBoxStyle.OkOnly, "Log in Form")
- MsgBox("Sorry Incorrect Username and Password", MsgBoxStyle.OkOnly, "Invalid")
- End If
- End Sub
- Finally, press F5 to run your project.
If you have any questions or suggestions about Login Form using Visual Basic.Net please contact me through our contact page.
Download Login Form Using Vb.Net Source code Here
Readers might read also:
- How to Create a Simple Login Form Using VB.net and MS Access
- How to Connect Visual Basic.Net to MS Access Database