KODE PADA KOLOM PILIHAN MAKANAN
Private Sub cbomakanan_Click()Select Case cbomakanan.Text
Case "Bakso Segitiga Pedas"
txthrgmak.Text = "20000"
Case "Bakso Gulung"
txthrgmak.Text = "15000"
Case "Mie Ayam Bakso"
txthrgmak.Text = "15000"
Case "Mie Ayam"
txthrgmak.Text = "12000"
Case "Mie Pangsit"
txthrgmak.Text = "10000"
Case "Mie Tek-tek"
txthrgmak.Text = "10000"
Case "Nasi Uduk"
txthrgmak.Text = "5000"
Case "Nasi Goreng"
txthrgmak.Text = "14000"
End Select
End Sub
KODE PADA KOLOM PILIHAN MINUMAN
Private Sub cbominuman_Click()Select Case cbominuman.Text
Case "Es teh manis"
txthrgmin.Text = "4000"
Case "Es Cappucino"
txthrgmin.Text = "5000"
Case "Es susu"
txthrgmin.Text = "6000"
Case "Jus Jeruk"
txthrgmin.Text = "8000"
Case "Jus Mangga"
txthrgmin.Text = "8000"
Case "Jus Alpukat"
txthrgmin.Text = "8000"
Case "Jus Melon"
txthrgmin.Text = "8000"
Case "Jus Buah Naga"
txthrgmin.Text = "9000"
Case "Sop Buah"
txthrgmin.Text = "9000"
End Select
txtmak.SetFocus
End Sub
KODE PADA TOMBOL CLEAR
Private Sub cmdhapus_Click()cbomakanan.Clear
cbominuman.Clear
Option1.Value = False
txthrgmak.Text = ""
txthrgmin.Text = ""
txtmak.Text = ""
txtmin.Text = ""
txtjumlah.Text = ""
txtbayar.Text = ""
txtkembali.Text = ""
End Sub
KODE PADA TOMBOL EXIT
Private Sub cmdkeluar_Click()a = MsgBox("Anda yakin ingin keluar?", vbQuestion + vbYesNo, "Keluar")
If a = vbYes Then
End
End If
End Sub
KODE PADA SUB FORM LOAD
Private Sub Form_Load()cbomakanan.AddItem "Bakso Segitiga Pedas"
cbomakanan.AddItem "Bakso Gulung"
cbomakanan.AddItem "Mie Ayam Bakso"
cbomakanan.AddItem "Mie Ayam"
cbomakanan.AddItem "Mie Pangsit"
cbomakanan.AddItem "Mie Tek-tek"
cbomakanan.AddItem "Nasi Uduk"
cbomakanan.AddItem "Nasi Goreng"
End Sub
KODE PADA OPTION
Private Sub Option1_Click()If Option1.Value = True Then
cbominuman.AddItem "Es teh manis"
cbominuman.AddItem "Es Cappucino"
cbominuman.AddItem "Es susu"
cbominuman.AddItem "Jus Jeruk"
cbominuman.AddItem "Jus Mangga"
cbominuman.AddItem "Jus Alpukat"
cbominuman.AddItem "Jus Melon"
cbominuman.AddItem "Jus Buah Naga"
cbominuman.AddItem "Sop Buah"
End If
End Sub
KODE MENGGUNAKAN ENTER
Private Sub txtbayar_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then
txtkembali.Text = Val(txtbayar.Text) - Val(txtjumlah.Text)
End If
End Sub
KODE HASIL MENGGUNAKAN ENTER
Private Sub txtmin_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then
txtjumlah.Text = Val(txtmak.Text) * Val(txthrgmak) + Val(txtmin.Text) * Val(txthrgmin)
txtbayar.SetFocus
End If
End Sub