Selasa, 26 Januari 2010

Program Hotel ( Visual Basic )





Dim fasilitas, tv, internet, sewa, total, bayar, kembali As Long


Private Sub Check1_Click()
If Check1.Value = 1 Then
internet = 200000
Else
internet = 0
End If
hitung
End Sub

Private Sub Check2_Click()
If Check2.Value = 1 Then
tv = 100000
Else
internet = 0
End If
hitung
End Sub




Private Sub Combo1_Click()
If Combo1.Text = "S001" Then
Text2.Text = "Single Bad"
ElseIf Combo1.Text = "D001" Then
Text2.Text = "Double Bad"
End If
End Sub

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

Private Sub Command2_Click()
Dim pesan As String
pesan = MsgBox("yakin Anda akan keluar?", vbYesNo, "KONFIRMASI")
If pesan = vbYes Then
End
End If
End Sub

Private Sub Form_Load()
'untuk menambahakan kode kamar di combo 1
Combo1.AddItem "S001"
Combo1.AddItem "D001"
End Sub

Private Sub Option1_Click()
If Combo1.Text = "S001" Then
sewa = 1000000
ElseIf Combo1.Text = "D001" Then
sewa = 1200000
Else
sewa = 0
End If
Text3.Text = Format(sewa, "currency")
End Sub

Private Sub Option2_Click()
If Combo1.Text = "S001" Then
sewa = 900000
ElseIf Combo1.Text = "D001" Then
sewa = 1000000
Else
sewa = 0
End If
Text3.Text = Format(sewa, "currency")
End Sub

Private Sub Option3_Click()
If Combo1.Text = "S001" Then
sewa = 800000
ElseIf Combo1.Text = "D001" Then
sewa = 900000
Else
sewa = 0
End If
Text3.Text = Format(sewa, "currency")
End Sub

Sub hitung()
fasilitas = tv + internet
Text4.Text = Format(fasilitas, "currency")
total = fasilitas + sewa
Text5.Text = Format(total, "currency")
Text6.SetFocus

End Sub

Private Sub Text6_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
bayar = Text6.Text
Text6.Text = Format(bayar, "currency")
kembali = bayar - total
Text7.Text = Format(kembali, "currency")
End If

End Sub









Tidak ada komentar:

Posting Komentar