SELANJUTNYA desain sesuai dengan kebutuhan, contohnya seperti gambar ini
LANJUT kodenya seperti ini
KODE TOMBOL PROGRAM COMBO BOX MERK PRODUK
Private Sub cbonama_Click()
If cbonama.Text = "ASUS" Then
txtharga.Text = "4400000"
ElseIf cbonama.Text = "ACER" Then
txtharga.Text = "4500000"
ElseIf cbonama.Text = "DELL" Then
txtharga.Text = "4350000"
ElseIf cbonama.Text = "TOSHIBA" Then
txtharga.Text = "4700000"
ElseIf cbonama.Text = "ZIREX" Then
txtharga.Text = "3900000"
End If
txtjumlah.SetFocus
End Sub
KODE TOMBOL PROGRAM BELI
Private Sub cmdbeli_Click()
txtnama.Text = ""
txtalamat.Text = ""
txtno.Text = ""
txtharga.Text = ""
txtjumlah.Text = ""
txtuang.Text = ""
txttotal.Text = ""
cbonama.Text = ""
txtnama.SetFocus
End Sub
KODE TOMBOL PROGRAM HITUNG
Private Sub cmdhitung_Click()
txttotal.Text = Val(txtuang.Text) - Val(txtharga.Text) * Val(txtjumlah)
End Sub
KODE TOMBOL PROGRAM SELESAI
Private Sub cmdselesai_Click()
Unload Me
End Sub
KODE TOMBOL PROGRAM SUB FORM LOAD
Private Sub Form_Load()
cbonama.AddItem "ASUS"
cbonama.AddItem "ACER"
cbonama.AddItem "DELL"
cbonama.AddItem "TOSHIBA"
cbonama.AddItem "ZIREX"
End Sub
TERAKHIR... coba jalankan programnya seperti ini
Tidak ada komentar:
Posting Komentar