[VB.net] How to do a Log In System

|

Cappie is going to show you guys how to do a Log In System on VB .net. With pictures!
Tutorial Level: Very Easy

Requirements:
1 Form
2 Label
2 TextBox
2 Button
1 Picture (Optional)

Just try to organize like the image below:

Image and video hosting by TinyPic

Ok, now add this code to the "OK" button.

If TextBox1.Text = "cappie" And TextBox2.Text = "williams" Then
MsgBox("You are logged in!")
Form2.Show()
Else
MsgBox("Username or Password incorrect.", MsgBoxStyle.Critical, "")
End If
If TextBox1.Text = "" And TextBox2.Text = "" Then
MsgBox("Type anything!", MsgBoxStyle.Critical, "")
End If
Me.Close()

Ok. Let’s explain the codes.

If TextBox1.Text = "cappie" And TextBox2.Text = "williams" Then
MsgBox("You are logged in!")
Form2.Show()


If the TextBox1 (Username text box) is filled with “cappie” and TextBox2 with “williams” you are right and will show the Form2.

Else
MsgBox("Username or Password incorrect.", MsgBoxStyle.Critical, "")
End If

If isn’t, won’t show Form2.

If TextBox1.Text = "" And TextBox2.Text = "" Then
MsgBox("Type anything!", MsgBoxStyle.Critical, "")
End If

If you don’t type anything, a MsgBox will appear and say to you type anything.

Now, add the code below to the “Cancel” button:
End

It's easy to do, but if you are a beginner you can download the source code below:

Download!
Rapidshare (Check this post to trick RS)
Sendspace
HotFile

Tutorial by Cappie Williams
Source by Cappie Williams

0 comentários:

Postar um comentário