First : Make form like this
Step 2:
Put this script into the Code Windows in project explorer:
Dim Keluar As Date, Masuk As Date
Dim hasil As Date
Dim tarif As Single
Private Sub cmdproses_Click()
If Frame1.Visible = False Then Frame1.Visible = True
TextPlat.Text = txtnomor.Text
Masuk = textmasuk.Text
Keluar = textkeluar.Text
hasil = Keluar - Masuk
lblhasil.Caption = hasil
jenis = combo1.Text
If jenis = "motor" Then
If hasil < "2:00" Then
lbltarif.Caption = 1500
ElseIf hasil < "3:00" Then
lbltarif.Caption = 2000
ElseIf hasil > "3:00" Then
lbltarif.Caption = 2500
End If
End If
If jenis = "mobil" Then
If hasil < "2:00" Then
lbltarif.Caption = 2000
ElseIf hasil < "3:00" Then
lbltarif.Caption = 3000
ElseIf hasil > "3:00" Then
lbltarif.Caption = 5000
End If
End If
If jenis = "truck" Then
If hasil < "2:00" Then
lbltarif.Caption = 2500
ElseIf hasil < "3:00" Then
lbltarif.Caption = 5000
ElseIf hasil > "3:00" Then
lbltarif.Caption = 7000
End If
End If
End Sub
Private Sub Form_Load()
combo1.AddItem "motor"
combo1.AddItem "mobil"
combo1.AddItem "truck"
End Sub
Step 3:
Run the program
^_^


Tidak ada komentar:
Posting Komentar