1. Groupbox sebanyak 2 buah
2. label sebanyak 6 buah
3. textbox sebanyak 5 buah
4. datagrid sebanyak1 buah
5. Serta sebuah database yang telah pernah disimpan dan menambahkan table tblPelanggan dengan isi
*Kode_Pemasok
*Nama_Pemasok
*Alamat
*Telepon
*Kota
6. Button sebanyak 3 buah
7. icon untuk tombol sebanyak 3
8. gambar untuk background aplikasi
kemudian ubah nama tool tersebut sesuai di gambar
untuk Source code sebagai berikut :Imports System.Data.OleDb
Public Class frmPemasok
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 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 tblPemasok VALUES ('" & TextBox1.Text & "' ,'" & TextBox2.Text & "','" & TextBox3.Text & "','" & Val(TextBox4.Text) & "','" & TextBox5.Text & "')"
Cmd.Connection = Conn
Cmd.ExecuteNonQuery()
Conn.Close()
Dim grid As OleDbDataAdapter
grid = New OleDbDataAdapter("select * from tblPemasok", Conn)
Dim ds As DataSet
ds = New DataSet
grid.Fill(ds, "tblPemasok")
DataGridView1.DataSource = ds.Tables("tblPemasok")
End Sub
Private Sub frmPemasok_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Conn.ConnectionString = Conns
Dim grid As OleDbDataAdapter
grid = New OleDbDataAdapter("select * from tblPemasok", Conn)
Dim ds As DataSet
ds = New DataSet
grid.Fill(ds, "tblPemasok")
DataGridView1.DataSource = ds.Tables("tblPemasok")
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
TextBox5.Clear()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Beranda.Show()
Me.Hide()
End Sub
End Class
jalankan aplikasi dengan cara debug isi aplikasi kemudian simpan untuk melihat ke datagridview
Tidak ada komentar:
Posting Komentar