DISKRIPSI LATIHAN 33 A
Deskripsi form Latihan_33a_36110030
Dalam form Latihan_33a_36110030 hanya
terdapat dua object
yaitu DataGriedView dan Button
Object
datagridview :
Dalam form ini terdapat 1 buah object datagridview. Datagridview digunakan untuk menampilkan data ke dalam bentuk table yang terdiri dari baris dan kolom.
Dalam form ini terdapat 1 buah object datagridview. Datagridview digunakan untuk menampilkan data ke dalam bentuk table yang terdiri dari baris dan kolom.
Object Button :
Dalam form ini terdapat dua buah object button yang bertuliskan “tambah” , “edit” dan “hapus”. Button “edit” ini digunakan untuk menampilkan form Latihan_33b_36110030 dan mengedit/mengganti kode barang yang diinginkan . Button “tambah” digunakan untuk menampilkan form Latihan_33b_36110030 dan menambahkan data ke dalam database. Sedangkan button “hapus” digunakan untuk menghapus data yang diinginkan.
Script Unique :
Dalam form ini tidak terdapat script unique.
Even :
Load
Button Click
PROSEDUR PENYELSAIAN LATIHAN 33 A
1.KLIK STAR KEMUDIAN PILIH MICROSOFT VISUAL STUDIO 2008
2.KEMUDIAN KLIK NEW PROJECT PADA FILE
3.KEMUDIAN KLIK ADD UNTUK MENAMBAHKAN PROJECT
4.
KEMUDIAN BUATLAH FORM SEPERTI DIBAWAH INI :
5. KEMUDIAN MASUKAN RUMUS SEPERTI INI
Public Class Latihan_33a_36110030
Dim Jalan As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source =E:\semester 5\Apkom 4\LATIHAN 27-34 SIMPAN EDIT DELETE DATA\databarang.accdb;jet oledb:database password=hma")
Dim ambil As New DataTable
Public Sub yhuyal()
Dim data As New OleDb.OleDbDataAdapter
data = New OleDb.OleDbDataAdapter("SELECT* FROM barang", Jalan)
ambil.Rows.Clear()
data.Fill(ambil)
data.Dispose()
End Sub
Private Sub Latihan_33a_36110030_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
yhuyal()
dgv_36110030.DataSource = ambil
End Sub
Private Sub tambah_36110030_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tambah_36110030.Click
If Latihan_33b_36110030.Visible = False Then
Latihan_33b_36110030.Show()
Else
Latihan_33b_36110030.Show()
End If
Latihan_33b_36110030.kode2_36110030.Text = "-"
Latihan_33b_36110030.Kode1_36110030.Text = " "
Latihan_33b_36110030.Nama_36110030.Text = " "
Latihan_33b_36110030.Harga_36110030.Text = " "
Latihan_33b_36110030.Jumlah_36110030.Text = " "
End Sub
Private Sub edit_36110030_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Edit_36110030.Click
If Latihan_33b_36110030.Visible = False Then
Latihan_33b_36110030.Show()
Else
Latihan_33b_36110030.Activate()
End If
Latihan_33b_36110030.kode2_36110030.Text = dgv36110030.CurrentRow.Cells("kodebarang").Value
Latihan_33b_36110030.Kode1_36110030.Text = dgv36110030.CurrentRow.Cells("kodebarang").Value
Latihan_33b_36110030.Nama_36110030.Text = dgv36110030.CurrentRow.Cells("namabarang").Value
Latihan_33b_36110030.Harga_36110030.Text =dgv36110030..CurrentRow.Cells("hargajual").Value
Latihan_33b_36110030.Jumlah_36110030.Text = dgv36110030..CurrentRow.Cells("JumlahBarang").Value
End Sub
Private Sub hapus_36110030_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hapus_36110030.Click
If MsgBox("Seriously you want to delete the data???", MsgBoxStyle.YesNo) = MsgBoxResult.No Then
Exit Sub
End If
Dim Cm As New OleDb.OleDbCommand
Cm = New OleDb.OleDbCommand(" delete * from barang where kodebarang ='" & dgv46110003.CurrentRow.Cells("Kodebarang").Value & "'", Jalan)
Jalan.Open()
Cm.ExecuteNonQuery()
Jalan.Close()
Cm.Dispose()
yhuyal()
End Sub
End Class
Dim Jalan As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source =E:\semester 5\Apkom 4\LATIHAN 27-34 SIMPAN EDIT DELETE DATA\databarang.accdb;jet oledb:database password=hma")
Dim ambil As New DataTable
Public Sub yhuyal()
Dim data As New OleDb.OleDbDataAdapter
data = New OleDb.OleDbDataAdapter("SELECT* FROM barang", Jalan)
ambil.Rows.Clear()
data.Fill(ambil)
data.Dispose()
End Sub
Private Sub Latihan_33a_36110030_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
yhuyal()
dgv_36110030.DataSource = ambil
End Sub
Private Sub tambah_36110030_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tambah_36110030.Click
If Latihan_33b_36110030.Visible = False Then
Latihan_33b_36110030.Show()
Else
Latihan_33b_36110030.Show()
End If
Latihan_33b_36110030.kode2_36110030.Text = "-"
Latihan_33b_36110030.Kode1_36110030.Text = " "
Latihan_33b_36110030.Nama_36110030.Text = " "
Latihan_33b_36110030.Harga_36110030.Text = " "
Latihan_33b_36110030.Jumlah_36110030.Text = " "
End Sub
Private Sub edit_36110030_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Edit_36110030.Click
If Latihan_33b_36110030.Visible = False Then
Latihan_33b_36110030.Show()
Else
Latihan_33b_36110030.Activate()
End If
Latihan_33b_36110030.kode2_36110030.Text = dgv36110030.CurrentRow.Cells("kodebarang").Value
Latihan_33b_36110030.Kode1_36110030.Text = dgv36110030.CurrentRow.Cells("kodebarang").Value
Latihan_33b_36110030.Nama_36110030.Text = dgv36110030.CurrentRow.Cells("namabarang").Value
Latihan_33b_36110030.Harga_36110030.Text =dgv36110030..CurrentRow.Cells("hargajual").Value
Latihan_33b_36110030.Jumlah_36110030.Text = dgv36110030..CurrentRow.Cells("JumlahBarang").Value
End Sub
Private Sub hapus_36110030_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hapus_36110030.Click
If MsgBox("Seriously you want to delete the data???", MsgBoxStyle.YesNo) = MsgBoxResult.No Then
Exit Sub
End If
Dim Cm As New OleDb.OleDbCommand
Cm = New OleDb.OleDbCommand(" delete * from barang where kodebarang ='" & dgv46110003.CurrentRow.Cells("Kodebarang").Value & "'", Jalan)
Jalan.Open()
Cm.ExecuteNonQuery()
Jalan.Close()
Cm.Dispose()
yhuyal()
End Sub
End Class
6. KEMUDIAN
UJI PROGRAM
7. JIKA SUDAH
BERHASIL Save program anda
8.SE;LESAI
0 komentar:
Posting Komentar