Saturday, October 29, 2011

Belajar Vb



LISTING PROGRAM
Private Sub Command1_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Combo1.Text = ""
Option1.Value = False
Option2.Value = False
Option3.Value = False
List1 = ""
End Sub


Private Sub Command2_Click()
X = MsgBox("YAKIN ANDA INGIN KELUAR?!", vbQuestion + vbYesNo, "PERINGATAN")
If X = vbYes Then
Unload Me
End If
End Sub
Private Sub Form_Load()
Combo1 = "-NAMA KAMAR-"
Combo1.AddItem "MAWAR"
Combo1.AddItem "DAHLIA"
Combo1.AddItem "ANGGREK"
List1.AddItem "SINGLE"
List1.AddItem "DOUBLE"
List1.AddItem "FAMILY"
End Sub



Private Sub Option1_Click()
If List1 = "SINGLE" Then
Text3.Text = 200000
ElseIf List1 = "DOUBLE" Then
Text3.Text = 400000
Else
Text3.Text = 600000
End If
End Sub

Private Sub Option2_Click()
If List1 = "SUITE" Then
Text3.Text = 300000
ElseIf List1 = "DOUBLE" Then
Text3.Text = 500000
Else
Text3.Text = 800000
End If
End Sub
Private Sub Option3_Click()
If List1 = "SINGLE" Then
Text3.Text = 500000
ElseIf List1 = "DOUBLE" Then
 Text3.Text = 800000
Else
Text3.Text = 1000000
End If
End Sub

Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text5.Text = Val(Text3.Text) * Val(Text4.Text)
If Text4.Text > 5 Then
Text6.Text = 10 / 100 * Val(Text5.Text)
Else
Text6.Text = 0
End If
Text7.Text = Val(Text5.Text) - Val(Text6.Text)
End If
End Sub

Private Sub Timer1_Timer()
Text2.Text = Format(Date, "dd; mmmm; yyyy")
End Sub
Silahkan dicoba semoga bermanfaat.

No comments:

Post a Comment