Friday 31 August 2012

VB Login Form


Step 1: Place two Labels, two Text boxes and two Command Buttons on the Form1 window
Step2: Reaname Label1 as username and Label2 as password (properties window change caption name).
Step3:Delete TextBox Text Property so that TextBox becomes empty.
Step4: Change CommandButton1 caption property as Login and CommandButton2 caption property as Cancel.
Step5: Click on Project from menu bar and select Add Form, click open then Form2 will be opend.
Step6: Take a Label on Form2 and change its text Property as WELCOME to ORACLE SQL.
Step7: Double click on commandbutton1 on Form1 and enter the following code
Private Sub Command1_Click()
If Text1.Text = "scott" And Text2.Text = "tiger" Then
Form2.Show
Form1.Hide
Else
MsgBox "Invalid Username and Password"
Text1.Text = ""
Text2.Text = ""
End If
End Sub

Step8: Select TextBox2 Password Character Property as *

Step9: Double click on Command Button2 and enter the following code

Private Sub Command2_Click()
End
End Sub

Step10: Press F5 and run the program

No comments:

Post a Comment