Rabu, 13 Januari 2016

Form Stok Obat

                                                                        Form Stock

Gambar form Stock



1. label sebanyak 4uah
2. Button sebanyak2buah
3. textbox sebanyak 4 buah
4. datagrid sebanyak1 buah
5. Serta sebuah database yang telah pernah disimpan dan menambahkan table tblPenjualan dengan isi
*Kode_Barang
*Nama_Barang
*Satuan
*Jumlah
6. icon untuk tombol sebanyak 2
7. gambar untuk background aplikasi
Ubah Masing masing Tool sesuai dengan gambar
untuk Source code sebagai berikut :

Imports System.Data.OleDb
Public Class frmStok
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 frmStok_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Conn.ConnectionString = Conns
Dim grid As OleDbDataAdapter
grid = New OleDbDataAdapter("select * from tblStok", Conn)
Dim ds As DataSet
ds = New DataSet
grid.Fill(ds, "tblStok")
DataGridView1.DataSource = ds.Tables("tblStok")
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim Cmd As New OleDbCommand
Dim conns As New OleDbConnection
Conn.Open()
Cmd.CommandText = "INSERT INTO tblStok VALUES ('" & TextBox1.Text & "' ,'" & TextBox2.Text & "','" & TextBox3.Text & "','" & Val(TextBox4.Text) & "' )"
Cmd.Connection = Conn
Cmd.ExecuteNonQuery()
Conn.Close()
Dim grid As OleDbDataAdapter
grid = New OleDbDataAdapter("select * from tblStok", Conn)
Dim ds As DataSet
ds = New DataSet
grid.Fill(ds, "tblStok")
DataGridView1.DataSource = ds.Tables("tblStok")
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Beranda.Show()
Me.Hide()
End Sub
End Class

Tidak ada komentar:

Posting Komentar