Rabu, 28 Desember 2011

Latihan 33

Public





a =
dt.Rows.Clear()
a.Fill(dt)
a.Dispose()
Class Latihan_33A_36109007Dim dt As New DataTableDim cm As New OleDb.OleDbCommandDim riri As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")Public Sub enal()Dim a As New OleDb.OleDbDataAdapterNew OleDb.OleDbDataAdapter("select * from barang", riri)End Sub
enal()
dgv36109007.DataSource = dt
Private Sub Latihan_33A_36109007_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadEnd Sub
cm =
riri.Open()
cm.ExecuteNonQuery()
riri.Close()
cm.Dispose()
enal()
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.ClickNew OleDb.OleDbCommand("delete * from barang where kodebarang = '" & dgv36109007.CurrentRow.Cells("kodebarang").Value & "'", riri)End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.ClickIf Latihan_33B_36109007.Visible = False ThenLatihan_33B_36109007.Show()
ElseLatihan_33B_36109007.Activate()
End IfLatihan_33B_36109007.txt136109007.Text = ""Latihan_33B_36109007.txt236109007.Text = ""Latihan_33B_36109007.txt336109007.Text = ""Latihan_33B_36109007.txt436109007.Text = ""Latihan_33B_36109007.KB.Text = "-"End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ClickIf Latihan_33B_36109007.Visible = False ThenLatihan_33B_36109007.Show()
ElseLatihan_33B_36109007.Activate()
End IfLatihan_33B_36109007.txt136109007.Text = dgv36109007.CurrentRow.Cells(
Latihan_33B_36109007.txt236109007.Text = dgv36109007.CurrentRow.Cells(
Latihan_33B_36109007.txt336109007.Text = dgv36109007.CurrentRow.Cells(
Latihan_33B_36109007.txt436109007.Text = dgv36109007.CurrentRow.Cells(
Latihan_33B_36109007.KB.Text = dgv36109007.CurrentRow.Cells(
Latihan_33B_36109007.Show()

End

Public





a =
dt.Rows.Clear()
a.Fill(dt)
a.Dispose()

Class Latihan_34B_36109007Dim dt As New DataTableDim cm As New OleDb.OleDbCommandDim riri As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")Public Sub febri()Dim a As New OleDb.OleDbDataAdapterNew OleDb.OleDbDataAdapter("select * from barang", riri)End Sub
febri()
dgv36109007.DataSource = dt
Private Sub Latihan_34B_36109007_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadEnd Sub
cm =
riri.Open()
cm.ExecuteNonQuery()
riri.Close()
cm.Dispose()
febri()
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.ClickNew OleDb.OleDbCommand("delete * from barang where kodebarang = '" & dgv36109007.CurrentRow.Cells("kodebarang").Value & "'", riri)End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.ClickIf Latihan_34C_36109007.Visible = False ThenLatihan_34C_36109007.MdiParent =
Latihan_34C_36109007.Show()
Me.MdiParentElseLatihan_34C_36109007.Activate()
End IfLatihan_34C_36109007.txt136109007.Text = ""Latihan_34C_36109007.txt236109007.Text = ""Latihan_34C_36109007.txt336109007.Text = ""Latihan_34C_36109007.txt436109007.Text = ""Latihan_34C_36109007.KB.Text = "-"End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ClickIf Latihan_34C_36109007.Visible = False ThenLatihan_34C_36109007.MdiParent =
Latihan_34C_36109007.Show()
Me.MdiParentElseLatihan_34C_36109007.Activate()
End IfLatihan_34C_36109007.txt136109007.Text = dgv36109007.CurrentRow.Cells(
Latihan_34C_36109007.txt136109007.Text = dgv36109007.CurrentRow.Cells(
Latihan_34C_36109007.txt336109007.Text = dgv36109007.CurrentRow.Cells(
Latihan_34C_36109007.txt436109007.Text = dgv36109007.CurrentRow.Cells(
Latihan_34C_36109007.KB.Text = dgv36109007.CurrentRow.Cells(
Latihan_34C_36109007.Show()

End

Public




Class Latihan_34C_36109007Dim riri As New ByIskandar.CariKeDataBaseByIskandarDim cm As New OleDb.OleDbCommandDim enal As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")Private Sub indonesia()If txt136109007.Text.Length = 0 ThenMsgBox(
"Isi rong itu yang kosong")Exit SubEnd IfIf txt236109007.Text.Length = 0 ThenMsgBox(
"Isi rong itu yang kosong")Exit SubEnd IfIf Val(txt336109007.Text) = 0 ThenMsgBox(
"Isi rong itu yang kosong")Exit SubEnd IfIf Val(txt436109007.Text) = 0 ThenMsgBox(
"Isi rong itu yang kosong")Exit SubEnd IfEnd Sub
indonesia()
riri.AturPencarianDataBase(
Private Sub tambah()"Barang", "KodeBarang", txt136109007.Text, 1, enal)If riri.JumlanBaris > 0 ThenMsgBox(
"Adami kode barang seperti itu")Exit SubEnd Ifcm =
enal.Open()
cm.ExecuteNonQuery()
enal.Close()
cm.Dispose()
txt136109007.Text =
New OleDb.OleDbCommand("insert into barang(kodebarang, namabarang, hargajual, jumlahbarang) values ('" & txt136109007.Text & "','" & txt236109007.Text & "'," & Val(txt336109007.Text) & "," & Val(txt436109007.Text) & ")", enal)""txt236109007.Text = ""txt336109007.Text = ""txt436109007.Text = ""Latihan_34B_36109007.febri()
End Sub
indonesia()
Private Sub edit()If txt136109007.Text <> KB.Text Thenriri.AturPencarianDataBase(
"Barang", "KodeBarang", txt136109007.Text, 1, enal)If riri.JumlanBaris > 0 ThenMsgBox(
"Adami kode barang seperti itu")Exit SubEnd IfEnd Ifcm =
enal.Open()
cm.ExecuteNonQuery()
enal.Close()
cm.Dispose()
txt136109007.Text =
New OleDb.OleDbCommand("update barang set kodebarang = '" & txt136109007.Text & "', namabarang = '" & txt236109007.Text & "', hargajual = " & Val(txt336109007.Text) & ", jumlahbarang = " & Val(txt436109007.Text) & " where kodebarang = '" & KB.Text & "'", enal)""txt236109007.Text = ""txt336109007.Text = ""txt436109007.Text = ""KB.Text = "_"Latihan_34B_36109007.febri()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ClickIf KB.Text = "-" Thentambah()
Elseedit()
End IfEnd Sub
End Class
"kodebarang").Value"namabarang").Value"hargajual").Value"jumlahbarang").Value"kodebarang").ValueEnd Sub Class
"kodebarang").Value"namabarang").Value"hargajual").Value"jumlahbarang").Value"kodebarang").ValueEnd Sub Class

Latihan 34

Public

Class Latihan_34A_36109007Private Sub DaftarBarangToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DAFTARBARANGToolStripMenuItem.ClickIf Latihan_34B_36109007.Visible = False ThenLatihan_34B_36109007.MdiParent = MeLatihan_34B_36109007.Show()
ElseLatihan_34B_36109007.Activate()
End IfEnd Sub
Private Sub KodeBarangToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KodeBarangToolStripMenuItem.ClickIf Latihan_34C_36109007.Visible = False ThenLatihan_34C_36109007.MdiParent = MeLatihan_34C_36109007.Show()
ElseLatihan_34C_36109007.Activate()
End IfEnd Sub
Private Sub ToolStripLabel1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripLabel1.ClickIf Latihan_34B_36109007.Visible = False ThenLatihan_34B_36109007.MdiParent = MeLatihan_34B_36109007.Show()
ElseLatihan_34B_36109007.Activate()
End IfEnd Sub
Private Sub ToolStripLabel2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripLabel2.ClickIf Latihan_34C_36109007.Visible = False ThenLatihan_34C_36109007.MdiParent = MeLatihan_34C_36109007.Show()
ElseLatihan_34C_36109007.Activate()
End If
End

Public





a =
dt.Rows.Clear()
a.Fill(dt)
a.Dispose()

Class Latihan_34B_36109007Dim dt As New DataTableDim cm As New OleDb.OleDbCommandDim riri As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")Public Sub febri()Dim a As New OleDb.OleDbDataAdapterNew OleDb.OleDbDataAdapter("select * from barang", riri)End Sub
febri()
dgv36109007.DataSource = dt
Private Sub Latihan_34B_36109007_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadEnd Sub
cm =
riri.Open()
cm.ExecuteNonQuery()
riri.Close()
cm.Dispose()
febri()
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.ClickNew OleDb.OleDbCommand("delete * from barang where kodebarang = '" & dgv36109007.CurrentRow.Cells("kodebarang").Value & "'", riri)End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.ClickIf Latihan_34C_36109007.Visible = False ThenLatihan_34C_36109007.MdiParent =
Latihan_34C_36109007.Show()
Me.MdiParentElseLatihan_34C_36109007.Activate()
End IfLatihan_34C_36109007.txt136109007.Text = ""Latihan_34C_36109007.txt236109007.Text = ""Latihan_34C_36109007.txt336109007.Text = ""Latihan_34C_36109007.txt436109007.Text = ""Latihan_34C_36109007.KB.Text = "-"End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ClickIf Latihan_34C_36109007.Visible = False ThenLatihan_34C_36109007.MdiParent =
Latihan_34C_36109007.Show()
Me.MdiParentElseLatihan_34C_36109007.Activate()
End IfLatihan_34C_36109007.txt136109007.Text = dgv36109007.CurrentRow.Cells(
Latihan_34C_36109007.txt136109007.Text = dgv36109007.CurrentRow.Cells(
Latihan_34C_36109007.txt336109007.Text = dgv36109007.CurrentRow.Cells(
Latihan_34C_36109007.txt436109007.Text = dgv36109007.CurrentRow.Cells(
Latihan_34C_36109007.KB.Text = dgv36109007.CurrentRow.Cells(
Latihan_34C_36109007.Show()

End

Public




Class Latihan_34C_36109007Dim riri As New ByIskandar.CariKeDataBaseByIskandarDim cm As New OleDb.OleDbCommandDim enal As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")Private Sub indonesia()If txt136109007.Text.Length = 0 ThenMsgBox(
"Isi rong itu yang kosong")Exit SubEnd IfIf txt236109007.Text.Length = 0 ThenMsgBox(
"Isi rong itu yang kosong")Exit SubEnd IfIf Val(txt336109007.Text) = 0 ThenMsgBox(
"Isi rong itu yang kosong")Exit SubEnd IfIf Val(txt436109007.Text) = 0 ThenMsgBox(
"Isi rong itu yang kosong")Exit SubEnd IfEnd Sub
indonesia()
riri.AturPencarianDataBase(
Private Sub tambah()"Barang", "KodeBarang", txt136109007.Text, 1, enal)If riri.JumlanBaris > 0 ThenMsgBox(
"Adami kode barang seperti itu")Exit SubEnd Ifcm =
enal.Open()
cm.ExecuteNonQuery()
enal.Close()
cm.Dispose()
txt136109007.Text =
New OleDb.OleDbCommand("insert into barang(kodebarang, namabarang, hargajual, jumlahbarang) values ('" & txt136109007.Text & "','" & txt236109007.Text & "'," & Val(txt336109007.Text) & "," & Val(txt436109007.Text) & ")", enal)""txt236109007.Text = ""txt336109007.Text = ""txt436109007.Text = ""Latihan_34B_36109007.febri()
End Sub
indonesia()
Private Sub edit()If txt136109007.Text <> KB.Text Thenriri.AturPencarianDataBase(
"Barang", "KodeBarang", txt136109007.Text, 1, enal)If riri.JumlanBaris > 0 ThenMsgBox(
"Adami kode barang seperti itu")Exit SubEnd IfEnd Ifcm =
enal.Open()
cm.ExecuteNonQuery()
enal.Close()
cm.Dispose()
txt136109007.Text =
New OleDb.OleDbCommand("update barang set kodebarang = '" & txt136109007.Text & "', namabarang = '" & txt236109007.Text & "', hargajual = " & Val(txt336109007.Text) & ", jumlahbarang = " & Val(txt436109007.Text) & " where kodebarang = '" & KB.Text & "'", enal)""txt236109007.Text = ""txt336109007.Text = ""txt436109007.Text = ""KB.Text = "_"Latihan_34B_36109007.febri()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ClickIf KB.Text = "-" Thentambah()
Elseedit()
End IfEnd SubEnd Class
"kodebarang").Value"namabarang").Value"hargajual").Value"jumlahbarang").Value"kodebarang").ValueEnd Sub Class
End Sub Class

Latihan 35

Public




Class Latihan_35_36109007Dim dt As New DataTableDim cm As New OleDb.OleDbCommandDim febri As New ByIskandar.CariKeDataBaseByIskandarDim hma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/datamajemuk.ACCDB")End Class