Friday, April 1, 2011

If Then Else

Private Sub Command1_Click()
Dim harga As Currency
harga = 0
If jeniskamar(0).Value Then
harga = harga + 150000
ElseIf jeniskamar(1).Value Then
harga = harga + 250000
ElseIf jeniskamar(2).Value Then
harga = harga + 450000
End If
If fasilitas(0).Value Then
harga = harga + 50000

ElseIf fasilitas(1).Value Then
harga = harga + 75000
ElseIf fasilitas(2).Value Then
harga = harga + 100000
End If
MsgBox "harga total yang harus dibayarkan adalah" & vbNewLine & "Rp " & harga & ",-"
Dim bayar As Currency
Do
bayar = InputBox("masukkan jumlah yang anda bayarkan")
Loop Until bayar >= harga
If bayar > harga Then
MsgBox "kembalian anda : Rp " & bayar - harga & vbNewLine & "terima kasih"
Else
MsgBox "terima kasih"
End If
Call reset
End Sub

Sub reset()
Text1.Text = ""
jeniskamar(0).Value = True
Dim i As Integer
For i = 0 To 2
fasilitas(i).Value = False
Next
End Sub

Private Sub Command2_Click()
Form4.Show
Unload Me
End Sub

Private Sub Command3_Click()
End
End Sub

No comments:

Post a Comment