Selasa, 21 Maret 2017

Program Aplikasi Penjualan Makanan

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

Program Aplikasi Penjualan Barang


Kode Combo Box Nama Barang:
Private Sub cbonamabarang_Click()
If cbonamabarang.Text = "CINCIN" Then
txtharga.Text = "150000"
ElseIf cbonamabarang.Text = "KALUNG" Then
txtharga.Text = "250000"
End If
txtjumlah.SetFocus
End Sub
 
Kode Sub Form Load :
Private Sub Form_Load()
cbonamabarang.AddItem "CINCIN"
cbonamabarang.AddItem "KALUNG"
End Sub

Kode Tombol Belanja Lagi:
Private Sub cmdbelanjalagi_Click()
txtno.Text = ""
txtnamapembeli.Text = ""
txtharga.Text = ""
txtjumlah.Text = ""
txtdiskon.Text = ""
txttotal.Text = ""
cbonamabarang.Text = ""
txtno.SetFocus
End Sub


Kode Tombol Keluar:
Private Sub cmdkeluar_Click()
Unload Me
End Sub

Kode Tombol Hitung Total Belanja:
Private Sub txttotal_Click()
txttotal.Text = Val(txtharga.Text) * Val(txtjumlah.Text) - Val(txtdiskon.Text)
End Sub

Rabu, 15 Maret 2017

Program Aplikasi Peminjaman Buku


Kode Program Combo Box Kode Buku :

Private Sub cbokode_Click()
If cbokode.Text = "001" Then
txtjudul.Text = "Visual Basic"
txtpenerbit.Text = "Erlangga"
ElseIf cbokode.Text = "002" Then
txtjudul.Text = "Bahasa Indonesia"
txtpenerbit.Text = "Erlangga"
ElseIf cbokode.Text = "003" Then
txtjudul.Text = "Statistik"
txtpenerbit.Text = "Erlangga"
End If
End Sub

Kode Sub Form Load :
Private Sub Form_Load()
cbokode.AddItem "001"
cbokode.AddItem "002"
cbokode.AddItem "003"
End Sub


Kode Program Tombol Pinjam Lagi :
Private Sub cmdpinjam_Click()
txtnomor.Text = ""
txtnama.Text = ""
cbokode.Text = ""
txtjudul.Text = ""
txtpenerbit.Text = ""
txtpinjam.Text = ""
txtkembali.Text = ""
txtnomor.SetFocus
End Sub

Kode Program Tombol Proses :
Private Sub cmdproses_Click()
txtkembali.Text = Val(txtpinjam.Text) + 7
End Sub

Kode Program Tombol Selesai :
Private Sub cmdselesai_Click()
Unload Me
End Sub

Program Aplikasi Gaji Karyawan


Kode Program Combo Box Jabatan :

Private Sub cbojabatan_Click()
If cbojabatan.Text = "M. Produksi" Then
txtpokok.Text = "3000000"
txttunjangan.Text = "1000000"
ElseIf cbojabatan.Text = "M. Personalia" Then
txtpokok.Text = "2500000"
txttunjangan.Text = "1000000"
ElseIf cbojabatan.Text = "M. Pemasaran" Then
txtpokok.Text = "2000000"
txttunjangan.Text = "500000"
ElseIf cbojabatan.Text = "M. Keuangan" Then
txtpokok.Text = "4000000"
txttunjangan.Text = "1500000"
End If
End Sub

Kode Sub Form Load :
Private Sub Form_Load()
cbojabatan.AddItem "M. Produksi"
cbojabatan.AddItem "M. Personalia"
cbojabatan.AddItem "M. Pemasaran"
cbojabatan.AddItem "M. Keuangan"
End Sub


Kode Program Tombol Keluar :
Private Sub cmdkeluar_Click()
Unload Me
End Sub

Kode Program Tombol Mulai Lagi :
Private Sub cmdlagi_Click()
txtnama.Text = ""
txtnip.Text = ""
cbojabatan.Text = ""
txttunjangan.Text = ""
txtpajak.Text = ""
txtbersih.Text = ""
txtpokok.Text = ""
txtnama.SetFocus
End Sub

Kode Program Tombol Total :
Private Sub cmdtotal_Click()
txtpajak.Text = Val(txtpokok.Text) * 5 / 100
txtbersih.Text = Val((txtpokok.Text) + Val(txttunjangan.Text)) - Val(txtpajak.Text)
End Sub

Program Aplikasi Penjualan Toko Menggunakan ComboBox



Kode Program Combo Box Nomor Barang :
Private Sub cbonomor_Click()
If cbonomor.Text = "1" Then
txtbarang.Text = "sabun"
txtharga.Text = "2000"
ElseIf cbonomor.Text = "2" Then
txtbarang.Text = "rinso"
txtharga.Text = "1000"
ElseIf cbonomor.Text = "3" Then
txtbarang.Text = "shampo"
txtharga.Text = "3000"
ElseIf cbonomor.Text = "4" Then
txtbarang.Text = "pena"
txtharga.Text = "4000"
End If
txtjumlah.SetFocus
End Sub

Kode Sub Form Load :
Private Sub Form_Load()
cbonomor.AddItem "1"
cbonomor.AddItem "2"
cbonomor.AddItem "3"
cbonomor.AddItem "4"
End Sub

Kode Program Tombol Hitung :
Private Sub cmdhitung_Click()
txtbayar.Text = Val(txtharga.Text) * Val(txtjumlah.Text)
End Sub

Kode Program Tombol Hitung Lagi :
Private Sub cmdhitunglagi_Click()
txtnama.Text = " "
cbonomor.Text = " "
txtbarang.Text = " "
txtharga.Text = " "
txtjumlah.Text = " "
txtbayar.Text = "  "
txtnama.SetFocus
End Sub

Kode Program Tombol Selesai :
Private Sub cmdselesai_Click()
Unload Me
End Sub

Program Aplikasi Pengurangan 2 Bilangan


Kode Program Tombol Hitung :
Private Sub cmdhitung_Click()
txthasil.Text = Val(txtnilaipertama.Text) - Val(txtnilaikedua.Text)
End Sub

Kode Program Tombol Hitung lagi :
Private Sub cmdhitunglagi_Click()
txtnilaipertama.Text = " "
txtnilaikedua.Text = " "
txtnilaiketiga.Text = " "
txthasil.Text = " "
txtnilaipertama.SetFocus
End Sub

Kode Program Tombol Selesai :
Private Sub cmdselesai_Click()
Unload Me
End Sub

Selasa, 14 Maret 2017

Program Aplikasi Penjumlahan 2 Bilangan


Kode Program Tombol Hitung :
Private Sub cmdhitung_Click()
txthasil.Text = Val(txtnilaipertama.Text) + Val(txtnilaikedua.Text)
End Sub

Kode Program Tombol Hitung Lagi :
Private Sub cmdhitunglagi_Click()
txtnilaipertama.Text = " "
txtnilaikedua.Text = " "
txthasil.Text = " "
txtnilaipertama.SetFocus
End Sub

Kode Program Tombol Selesai :
Private Sub cmdselesai_Click()
Unload Me
End Sub