Bentuk Dari Form Penjualan :
1. label sebanyak 8 buah
2. Button sebanyak 3 buah
3. textbox sebanyak 9 buah
4. datagrid sebanyak1 buah
5. Serta sebuah database yang telah pernah disimpan dan menambahkan table tblPenjualan dengan isi
*Kode_Pelanggan
*Nama_Pelanggan
*nama_Obat
*Harga_Obat
*Jumlah_Obat
*Total
*Cash
*Kembalian
*tanggal
6. icon untuk tombol sebanyak 3
7. gambar untuk background aplikasi
Ubah Masing masing Tool sesuai dengan gambar
untuk Source code sebagai berikut :
Imports System.Data.OleDb
Public Class frmPenjualan
Private Conns As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & System.AppDomain.CurrentDomain.BaseDirectory & "\apotek.mdb;Persist Security Info=false"
Private Conn As New OleDbConnection
Public Function akses() As OleDbConnection
Dim conect As New OleDbConnection(Conns)
conect.Open()
Return conect
End Function
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Beranda.Show()
Me.Hide()
End Sub
Private Sub frmPenjualan_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Conn.ConnectionString = Conns
Dim grid As OleDbDataAdapter
grid = New OleDbDataAdapter("select * from tblPelanggan", Conn)
Dim ds As DataSet
ds = New DataSet
grid.Fill(ds, "tblPelanggan")
DataGridView1.DataSource = ds.Tables("tblPelanggan")
End Sub
Private Sub DataGridView1_CellContentDoubleClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellContentDoubleClick
TextBox1.Text = DataGridView1.Rows(e.RowIndex).Cells(0).Value
TextBox2.Text = DataGridView1.Rows(e.RowIndex).Cells(1).Value
End Sub
Private Sub TextBox5_Leave(sender As Object, e As EventArgs) Handles TextBox5.Leave
TextBox6.Text = Val(TextBox5.Text) * Val(TextBox4.Text)
End Sub
Private Sub TextBox7_Leave(sender As Object, e As EventArgs) Handles TextBox7.Leave
TextBox8.Text = Val(TextBox7.Text) - Val(TextBox6.Text)
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim grid As OleDbDataAdapter
grid = New OleDbDataAdapter("select * from tblPelanggan where Nama_Pelanggan='" & TextBox9.Text & "'", Conn)
Dim ds As DataSet
ds = New DataSet
grid.Fill(ds, "tblPelanggan")
DataGridView1.DataSource = ds.Tables("tblPelanggan")
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
TextBox5.Clear()
TextBox6.Clear()
TextBox7.Clear()
TextBox8.Clear()
End Sub
End Class
Untuk menjalankan aplikasi tekan f5 isi data maka akan disimpan kedatabase
Tidak ada komentar:
Posting Komentar