Contoh Aplikasi Program Penjualan Dengan Vb.net 2008 -
Private Sub txtKodeBarang_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtKodeBarang.KeyPress If e.KeyChar = Chr(13) Then Koneksi() cmd = New OleDbCommand("SELECT nama_barang, harga FROM barang WHERE kode_barang=@kode", conn) cmd.Parameters.AddWithValue("@kode", txtKodeBarang.Text) rd = cmd.ExecuteReader() If rd.Read() Then txtNamaBarang.Text = rd("nama_barang").ToString() txtHarga.Text = rd("harga").ToString() Else MsgBox("Barang tidak ditemukan") End If rd.Close() TutupKoneksi() txtQty.Focus() End If End Sub
' Load customer ke ComboBox Koneksi() da = New OleDbDataAdapter("SELECT id_customer, nama FROM customer", conn) dt = New DataTable() da.Fill(dt) cmbCustomer.DataSource = dt cmbCustomer.DisplayMember = "nama" cmbCustomer.ValueMember = "id_customer" TutupKoneksi() End Sub contoh aplikasi program penjualan dengan vb.net 2008
Sub TampilkanData() Koneksi() da = New OleDbDataAdapter("SELECT * FROM barang", conn) dt = New DataTable() da.Fill(dt) dgvBarang.DataSource = dt TutupKoneksi() End Sub Private Sub txtKodeBarang_KeyPress(sender As Object
dtDetail.Rows.Add(txtKodeBarang.Text, txtNamaBarang.Text, harga, qty, subtotal) total += subtotal lblTotal.Text = Format(total, "C2") txtKodeBarang.Clear() txtNamaBarang.Clear() txtHarga.Clear() txtQty.Clear() End Sub harga FROM barang WHERE kode_barang=@kode"
Sub CetakNota(noFaktur As String) ' Ambil data dari database teksNota = "NOTA PENJUALAN" & vbCrLf & "No Faktur: " & noFaktur & vbCrLf & "==================" ' ... tambahkan detail barang ... PrintPreviewDialog1.Document = pd PrintPreviewDialog1.ShowDialog() End Sub