Public Class FormBpc2
Private Sub btnproses_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnproses.Click
If
jumlahtiket.Text <> "" Then
totalharga.Text = harga.Text *
jumlahtiket.Text
Else
MessageBox.Show("Jumlah Tidak Boleh Kosong")
Exit
Sub
End If 'CallByName(jumlahtiket_KeyPress)
End Sub
Private Sub notiket_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
notiket.KeyPress
If
e.KeyChar = Chr(13) Then
If
notiket.Text = "001" Then
gbr.ImageLocation = "C:\Documents and Settings\All Users\Documents\My
Pictures\Sample Pictures\blue hills.jpg"
ElseIf
notiket.Text = "002" Then
gbr.ImageLocation = "C:\Documents
and Settings\All Users\Documents\My Pictures\Sample Pictures\Sunset.jpg"
ElseIf
notiket.Text = "003" Then
gbr.ImageLocation = "C:\Documents and Settings\All Users\Documents\My
Pictures\Sample Pictures\Water lilies.jpg"
Else
gbr.ImageLocation = "C:\Documents and Settings\All Users\Documents\My
Pictures\Sample Pictures\Winter.jpg"
End
If
End If
End Sub
Private Sub FormBpc2_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call
hapus()
tujuan.Items.Clear()
tujuan.Items.Add("Medan-Jakarta")
tujuan.Items.Add("Medan-Bandung")
tujuan.Items.Add("Medan-Aceh")
tujuan.Items.Add("Medan-Padang")
maskapai.Items.Clear()
maskapai.Items.Add("Lyon Air")
maskapai.Items.Add("Garuda")
maskapai.Items.Add("Merpati")
End Sub
Private Sub tujuan_Click(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles tujuan.Click
Select Case maskapai.Text
Case
"Lyon Air"
harga.Clear()
Select
Case tujuan.Text
Case
"Medan-Jakarta"
harga.Text = 1200000
Case
"Medan-Bandung"
harga.Text = 1400000
Case
"Medan-Padang"
harga.Text = 1500000
Case
"Medan-Aceh"
harga.Text = 1600000
End
Select
Case
"Garuda"
harga.Clear()
Select
Case tujuan.Text
Case
"Medan-Jakarta"
harga.Text = 2500000
Case
"Medan-Bandung"
harga.Text = 2600000
Case
"Medan-Padang"
harga.Text = 2700000
Case
"Medan-Aceh"
harga.Text = 2800000
End
Select
Case
"Merpati"
harga.Clear()
Select
Case tujuan.Text
Case
"Medan-Jakarta"
harga.Text = 3100000
Case
"Medan-Bandung"
harga.Text = 3200000
Case
"Medan-Padang"
harga.Text = 3300000
Case
"Medan-Aceh"
harga.Text = 3400000
End
Select
End Select
End Sub
Private Sub jumlahtiket_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
jumlahtiket.KeyPress
If
e.KeyChar = Chr(13) Then
If
jumlahtiket.Text <> "" Then
totalharga.Text = harga.Text *
jumlahtiket.Text
Else
MessageBox.Show("Jumlah Tidak Boleh Kosong")
Exit
Sub
End
If
End If
End Sub
Sub hapus()
notiket.Text = ""
maskapai.Text = ""
tujuan.Text = ""
harga.Text = ""
jumlahtiket.Text = ""
totalharga.Text = ""
End Sub
Private Sub btnhapus_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnhapus.Click
Call
hapus()
End Sub
Private Sub btnkeluar_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnkeluar.Click
Dim
Tanya As String
Tanya = MsgBox("Apakah
Anda Yakin Ingin Keluar?" & vbCrLf & "Harus Yakin", MsgBoxStyle.Question +
MsgBoxStyle.YesNo)
If Tanya = vbYes Then
Me.Close()
Else
Exit
Sub
End If
End Sub
End Class