Visual Basic#4
Sat, May 16, 2009
Today we can create a scenario to sharpen our skills.
-Create a form for login. if user click LOGIN, it will be redirect to another form called form2, if they’re click EXIT and program will be terminate.
-Create form2 containing login credentials to authorize users, if users success they will be redirect to another form, called form3 containing CORE Applications. if not valid, users will back in form2 to authorize them.
-Create form3, containing program to calculate triangles and squares. and give a little condition.
Source Code Form1.
Private Sub Command1_Click() End End Sub Private Sub Command2_Click() Form2.Show Form1.Enabled = False Form3.Visible = False End Sub
Source Code Form2.
Private Sub Command1_Click()
If Text1.Text = "99999999" And Text2.Text = "rizq" And Text3.Text = "basic" Then
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Form3.Show
Form1.Enabled = False
Form2.Enabled = False
Command1.Enabled = False
ElseIf Text1.Text = "99999999" And Text2.Text = "rizq" And Text3.Text <> "basic" Then
Text1.Enabled = False
Text2.Enabled = False
Command1.Enabled = False
MsgBox "User dan NIM Anda Benar, Password Anda salah"
ElseIf Text1.Text <> "99999999" And Text2.Text = "rizq" And Text3.Text = "basic" Then
Text1.Enabled = False
Text2.Enabled = False
Command1.Enabled = False
MsgBox "User dan Password Anda Benar, NIM Anda salah"
ElseIf Text1.Text = "99999999" And Text2.Text <> "rizq" And Text3.Text = "basic" Then
Text1.Enabled = False
Text2.Enabled = False
Command1.Enabled = False
MsgBox "User dan Password Anda Benar, USER Anda salah"
Else
MsgBox "User,NIM dan Passwordnya Salah !"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End If
End Sub
Private Sub Command2_Click()
Form1.Show
Form1.Enabled = True
End Sub
Private Sub Form_Load()
End Sub
Source Code Form3.
Dim var1 As Single
Dim var2 As Single
Dim var4 As Single
Dim var5 As Single
Dim hasil1 As Single
Dim hasil2 As Single
Private Sub Command1_Click()
var1 = Text1.Text
var2 = Text2.Text
var3 = 2
kali = var1 * var2
hasil1 = kali / 2
Text3.Text = hasil1
If hasil1 < 10 Then
MsgBox "SEGITIGA KECIL"
End If
End Sub
Private Sub Command2_Click()
var4 = Text4.Text
var5 = Text5.Text
hasil2 = var4 * var5
Text6.Text = hasil2
If hasil2 < 15 Then
MsgBox "PERSEGI KECIL"
End If
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub Form_Load()
End Sub
SCREENSHOOT BELOW :




Source code download here
That's all, I Hope you learn something about it.






0 Comments For This Post
1 Trackbacks For This Post
May 16th, 2009 at 12:15 pm
[...] scenario like previoust post – i guessed you’ve something about [...]
Leave a Reply