Anda di halaman 1dari 2

Nama : Wahyu Syahidah

NIM : 0907055021

Program Pemesanan tiket


Private Sub hapus_Click()
nama.Text = ""
Jumlah.Text = ""
diskon.Text = ""
Bis = False
Kereta = False
nm.Caption = ""
htiket.Caption = ""
htotal.Caption = ""
End Sub

Private Sub proses_Click()


Dim jmldiskon As Long
Dim biaya As Long
Dim Lanjut As Boolean
Dim harga As Long
Dim Kode_Error As Integer
Dim biayatotal As Long
Lanjut = True

nm.Caption = "" & nama

If Jumlah.Text = "" Then


Lanjut = False
Kode_Error = 3
End If

If Bis = True And Kereta = False Then

htiket.Caption = "Rp. 28000"


harga = 28000

ElseIf Kereta = True And Bis = False Then


htiket.Caption = "Rp. 350000"
harga = 350000
Else
Lanjut = False
Kode_Error = 2
End If

If nama.Text = "" Then


Lanjut = False
Kode_Error = 1
End If

If Lanjut Then
If diskon.Text = "" Then
biayatotal = harga * Jumlah.Text
htotal = "Rp. " & biayatotal
ElseIf diskon.Text = "0" Then
biayatotal = harga * Jumlah.Text
htotal = "Rp. " & biayatotal
Else
biaya = harga * Jumlah.Text
jmldiskon = biaya * diskon.Text / 100
biayatotal = biaya - jmldiskon
htotal.Caption = "Rp. " & biayatotal
End If
Else

Pesan_Error (Kode_Error)
End If
End Sub
Function Pesan_Error(Error)
Select Case Error
Case 1
MsgBox "Masukkan Nama!", vbExclamation, "Pemberitahuan"
Case 2
MsgBox "Pilih Kendaraan!", vbExclamation, "Pemberitahuan"
Case 3
MsgBox "Masukkan Jumlah Tiket!", vbExclamation, "Pemberitahuan"
End Select
End Function

Gambar Form 

Anda mungkin juga menyukai