Public Class Form032B_36109019
Dim wahyuni As New ByIskandar.CariKeDataBaseByIskandar
Dim cm As New OleDb.OleDbCommand
Dim uni As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles save.Click
If t1_36109019.Text.ength = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If t2_36109019.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t3_36109019.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t4_36109019.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
wahyuni.AturPencarianDataBase("Barang", "KodeBarang", t1_36109019.Text, 1, uni)
If wahyuni.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
cm = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_36109019.Text & "','" & t2_36109019.Text & "'," & Val(t3_36109019.Text) & "," & Val(t4_36109019.Text) & ")", uni)
uni.Open()
cm.ExecuteNonQuery()
uni.Close()
cm.Dispose()
t1_36109019.Text = ""
t2_36109019.Text = ""
t3_36109019.Text = ""
t4_36109019.Text = ""
Form032A_36109019.wahyuni()
End Sub
End Class
-------------------------------------------------------------------------------------------------------------------------
Public Class Form032C_36109019
Dim wahyuni As New ByIskandar.CariKeDataBaseByIskandar
Dim cm As New OleDb.OleDbCommand
Dim uni As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If t1_36109019.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If t2_36109019.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t3_36109019.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t4_36109019.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If t1_36109019.Text <> KB.Text Then
wahyuni.AturPencarianDataBase("Barang", "KodeBarang", t1_36109019.Text, 1, uni)
If wahyuni.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
End If
cm = New OleDb.OleDbCommand("update barang set kodebarang = '" & t1_36109019.Text & "', namabarang = '" & t2_36109019.Text & "', hargajual = " & Val(t3_36109019.Text) & ", jumlahbarang = " & Val(t4_36109019.Text) & " where kodebarang = '" & KB.Text & "'", uni)
uni.Open()
cm.ExecuteNonQuery()
uni.Close()
cm.Dispose()
t1_36109019.Text = ""
t2_36109019.Text = ""
t3_36109019.Text = ""
t4_36109019.Text = ""
KB.Text = ""
Form032A_36109019.wahyuni()
End Sub
End Class
-------------------------------------------------------------------------------------------------------------------------
Public Class Form033A_36109019
Dim dt As New DataTable
Dim cm As New OleDb.OleDbCommand
Dim uni As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub wahyuni()
Dim a As New OleDb.OleDbDataAdapter
a = New OleDb.OleDbDataAdapter("select * from barang", uni)
dt.Rows.Clear()
a.Fill(dt)
a.Dispose()
End Sub
Private Sub Form033A_36109019_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
wahyuni()
dgv.DataSource = dt
End Sub
Private Sub tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tambah.Click
If Form033B_36109019.Visible = False Then
Form033B_36109019.Show()
Else
Form033B_36109019.Activate()
End If
Form033B_36109019.t1_36109019.Text = ""
Form033B_36109019.t2_36109019.Text = ""
Form033B_36109019.t3_36109019.Text = ""
Form033B_36109019.t4_36109019.Text = ""
Form033B_36109019.KB.Text = "-"
End Sub
Private Sub edit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles edit.Click
If Form033B_36109019.Visible = False Then
Form033B_36109019.Show()
Else
Form033B_36109019.Activate()
End If
Form033B_36109019.t1_36109019.Text = dgv.CurrentRow.Cells("kodebarang").Value
Form033B_36109019.t2_36109019.Text = dgv.CurrentRow.Cells("namabarang").Value
Form033B_36109019.t3_36109019.Text = dgv.CurrentRow.Cells("hargajual").Value
Form033B_36109019.t4_36109019.Text = dgv.CurrentRow.Cells("jumlahbarang").Value
Form033B_36109019.KB.Text = dgv.CurrentRow.Cells("kodebarang").Value
Form033B_36109019.Show()
End Sub
Private Sub hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus.Click
cm = New OleDb.OleDbCommand("delete * from barang where kodebarang = '" & dgv.CurrentRow.Cells("kodebarang").Value & "'", uni)
uni.Open()
cm.ExecuteNonQuery()
uni.Close()
cm.Dispose()
wahyuni()
End Sub
End Class
-------------------------------------------------------------------------------------------------------------------------
Public Class Form033B_36109019
Dim wahyuni As New ByIskandar.CariKeDataBaseByIskandar
Dim cm As New OleDb.OleDbCommand
Dim uni As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub indonesia()
If t1_36109019.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If t2_36109019.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t3_36109019.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t4_36109019.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
End Sub
Private Sub tambah()
indonesia()
wahyuni.AturPencarianDataBase("Barang", "KodeBarang", t1_36109019.Text, 1, uni)
If wahyuni.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
cm = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_36109019.Text & "','" & t2_36109019.Text & "'," & Val(t3_36109019.Text) & "," & Val(t4_36109019.Text) & ")", uni)
uni.Open()
cm.ExecuteNonQuery()
uni.Close()
cm.Dispose()
t1_36109019.Text = ""
t2_36109019.Text = ""
t3_36109019.Text = ""
t4_36109019.Text = ""
Form033A_36109019.wahyuni()
End Sub
Private Sub edit()
indonesia()
If t1_36109019.Text <> KB.Text Then
wahyuni.AturPencarianDataBase("Barang", "KodeBarang", t1_36109019.Text, 1, uni)
If wahyuni.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
End If
cm = New OleDb.OleDbCommand("update barang set kodebarang = '" & t1_36109019.Text & "', namabarang = '" & t2_36109019.Text & "', hargajual = " & Val(t3_36109019.Text) & ", jumlahbarang = " & Val(t4_36109019.Text) & " where kodebarang = '" & KB.Text & "'", uni)
uni.Open()
cm.ExecuteNonQuery()
uni.Close()
cm.Dispose()
t1_36109019.Text = ""
t2_36109019.Text = ""
t3_36109019.Text = ""
t4_36109019.Text = ""
KB.Text = "-"
Form033A_36109019.wahyuni()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If KB.Text = "-" Then
tambah()
Else
edit()
End If
End Sub
End Class
-------------------------------------------------------------------------------------------------------------------------
Public Class Form034A_36109019
Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
If Form034B_36109019.Visible = False Then
Form034B_36109019.MdiParent = Me
Form034B_36109019.Show()
Else
Form034B_36109019.Activate()
End If
End Sub
Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click
If Form034C_36109019.Visible = False Then
Form034C_36109019.MdiParent = Me
Form034C_36109019.Show()
Else
Form034C_36109019.Activate()
End If
End Sub
Private Sub INPUTBARANGToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles INPUTBARANGToolStripMenuItem.Click
If Form034C_36109019.Visible = False Then
Form034C_36109019.MdiParent = Me
Form034C_36109019.Show()
Else
Form034C_36109019.Activate()
End If
End Sub
Private Sub DAFTARBARANGToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DAFTARBARANGToolStripMenuItem.Click
If Form034B_36109019.Visible = False Then
Form034B_36109019.MdiParent = Me
Form034B_36109019.Show()
Else
Form034B_36109019.Activate()
End If
End Sub
End Class
-------------------------------------------------------------------------------------------------------------------------
Public Class Form034B_36109019
Dim dt As New DataTable
Dim cm As New OleDb.OleDbCommand
Dim uni As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub wahyuni()
Dim a As New OleDb.OleDbDataAdapter
a = New OleDb.OleDbDataAdapter("select * from barang", uni)
dt.Rows.Clear()
a.Fill(dt)
a.Dispose()
End Sub
Private Sub Form034B_36109019_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
wahyuni()
dgv.DataSource = dt
End Sub
Private Sub tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tambah.Click
If Form034C_36109019.Visible = False Then
Form034C_36109019.MdiParent = Me.MdiParent
Form034C_36109019.Show()
Else
Form034C_36109019.Activate()
End If
Form034C_36109019.t1_36109019.Text = dgv.CurrentRow.Cells("kodebarang").Value
Form034C_36109019.t2_36109019.Text = dgv.CurrentRow.Cells("namabarang").Value
Form034C_36109019.t3_36109019.Text = dgv.CurrentRow.Cells("hargajual").Value
Form034C_36109019.t4_36109019.Text = dgv.CurrentRow.Cells("jumlahbarang").Value
Form034C_36109019.KB.Text = dgv.CurrentRow.Cells("kodebarang").Value
Form034C_36109019.Show()
End Sub
Private Sub edit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles edit.Click
If Form034C_36109019.Visible = False Then
Form034C_36109019.MdiParent = Me.MdiParent
Form034C_36109019.Show()
Else
Form034C_36109019.Activate()
End If
Form034C_36109019.t1_36109019.Text = dgv.CurrentRow.Cells("kodebarang").Value
Form034C_36109019.t2_36109019.Text = dgv.CurrentRow.Cells("namabarang").Value
Form034C_36109019.t3_36109019.Text = dgv.CurrentRow.Cells("hargajual").Value
Form034C_36109019.t4_36109019.Text = dgv.CurrentRow.Cells("jumlahbarang").Value
Form034C_36109019.KB.Text = dgv.CurrentRow.Cells("kodebarang").Value
Form034C_36109019.Show()
End Sub
Private Sub hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus.Click
cm = New OleDb.OleDbCommand("delete * from barang where kodebarang = '" & dgv.CurrentRow.Cells("kodebarang").Value & "'", uni)
uni.Open()
cm.ExecuteNonQuery()
uni.Close()
cm.Dispose()
wahyuni()
End Sub
End Class
-------------------------------------------------------------------------------------------------------------------------
Public Class Form034C_36109019
Dim wahyuni As New ByIskandar.CariKeDataBaseByIskandar
Dim cm As New OleDb.OleDbCommand
Dim uni As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub indonesia()
If t1_36109019.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If t2_36109019.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t3_36109019.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t4_36109019.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
End Sub
Private Sub tambah()
indonesia()
wahyuni.AturPencarianDataBase("Barang", "KodeBarang", t1_36109019.Text, 1, uni)
If wahyuni.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
cm = New OleDb.OleDbCommand("insert into barang(kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_36109019.Text & "','" & t2_36109019.Text & "'," & Val(t3_36109019.Text) & "," & Val(t4_36109019.Text) & ")", uni)
uni.Open()
cm.ExecuteNonQuery()
uni.Close()
cm.Dispose()
t1_36109019.Text = ""
t2_36109019.Text = ""
t3_36109019.Text = ""
t4_36109019.Text = ""
Form034B_36109019.wahyuni()
End Sub
Private Sub edit()
indonesia()
If t1_36109019.Text <> KB.Text Then
wahyuni.AturPencarianDataBase("Barang", "KodeBarang", t1_36109019.Text, 1, uni)
If wahyuni.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
End If
cm = New OleDb.OleDbCommand("update barang set kodebarang = '" & t1_36109019.Text & "', namabarang = '" & t2_36109019.Text & "', hargajual = " & Val(t3_36109019.Text) & ", jumlahbarang = " & Val(t4_36109019.Text) & " where kodebarang = '" & KB.Text & "'", uni)
uni.Open()
cm.ExecuteNonQuery()
uni.Close()
cm.Dispose()
t1_36109019.Text = ""
t2_36109019.Text = ""
t3_36109019.Text = ""
t4_36109019.Text = ""
KB.Text = "-"
Form034B_36109019.wahyuni()
End Sub
Private Sub simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan.Click
If KB.Text = "-" Then
tambah()
Else
edit()
End If
End Sub
End Class
Dim wahyuni As New ByIskandar.CariKeDataBaseByIskandar
Dim cm As New OleDb.OleDbCommand
Dim uni As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles save.Click
If t1_36109019.Text.ength = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If t2_36109019.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t3_36109019.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t4_36109019.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
wahyuni.AturPencarianDataBase("Barang", "KodeBarang", t1_36109019.Text, 1, uni)
If wahyuni.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
cm = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_36109019.Text & "','" & t2_36109019.Text & "'," & Val(t3_36109019.Text) & "," & Val(t4_36109019.Text) & ")", uni)
uni.Open()
cm.ExecuteNonQuery()
uni.Close()
cm.Dispose()
t1_36109019.Text = ""
t2_36109019.Text = ""
t3_36109019.Text = ""
t4_36109019.Text = ""
Form032A_36109019.wahyuni()
End Sub
End Class
-------------------------------------------------------------------------------------------------------------------------
Public Class Form032C_36109019
Dim wahyuni As New ByIskandar.CariKeDataBaseByIskandar
Dim cm As New OleDb.OleDbCommand
Dim uni As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If t1_36109019.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If t2_36109019.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t3_36109019.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t4_36109019.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If t1_36109019.Text <> KB.Text Then
wahyuni.AturPencarianDataBase("Barang", "KodeBarang", t1_36109019.Text, 1, uni)
If wahyuni.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
End If
cm = New OleDb.OleDbCommand("update barang set kodebarang = '" & t1_36109019.Text & "', namabarang = '" & t2_36109019.Text & "', hargajual = " & Val(t3_36109019.Text) & ", jumlahbarang = " & Val(t4_36109019.Text) & " where kodebarang = '" & KB.Text & "'", uni)
uni.Open()
cm.ExecuteNonQuery()
uni.Close()
cm.Dispose()
t1_36109019.Text = ""
t2_36109019.Text = ""
t3_36109019.Text = ""
t4_36109019.Text = ""
KB.Text = ""
Form032A_36109019.wahyuni()
End Sub
End Class
-------------------------------------------------------------------------------------------------------------------------
Public Class Form033A_36109019
Dim dt As New DataTable
Dim cm As New OleDb.OleDbCommand
Dim uni As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub wahyuni()
Dim a As New OleDb.OleDbDataAdapter
a = New OleDb.OleDbDataAdapter("select * from barang", uni)
dt.Rows.Clear()
a.Fill(dt)
a.Dispose()
End Sub
Private Sub Form033A_36109019_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
wahyuni()
dgv.DataSource = dt
End Sub
Private Sub tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tambah.Click
If Form033B_36109019.Visible = False Then
Form033B_36109019.Show()
Else
Form033B_36109019.Activate()
End If
Form033B_36109019.t1_36109019.Text = ""
Form033B_36109019.t2_36109019.Text = ""
Form033B_36109019.t3_36109019.Text = ""
Form033B_36109019.t4_36109019.Text = ""
Form033B_36109019.KB.Text = "-"
End Sub
Private Sub edit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles edit.Click
If Form033B_36109019.Visible = False Then
Form033B_36109019.Show()
Else
Form033B_36109019.Activate()
End If
Form033B_36109019.t1_36109019.Text = dgv.CurrentRow.Cells("kodebarang").Value
Form033B_36109019.t2_36109019.Text = dgv.CurrentRow.Cells("namabarang").Value
Form033B_36109019.t3_36109019.Text = dgv.CurrentRow.Cells("hargajual").Value
Form033B_36109019.t4_36109019.Text = dgv.CurrentRow.Cells("jumlahbarang").Value
Form033B_36109019.KB.Text = dgv.CurrentRow.Cells("kodebarang").Value
Form033B_36109019.Show()
End Sub
Private Sub hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus.Click
cm = New OleDb.OleDbCommand("delete * from barang where kodebarang = '" & dgv.CurrentRow.Cells("kodebarang").Value & "'", uni)
uni.Open()
cm.ExecuteNonQuery()
uni.Close()
cm.Dispose()
wahyuni()
End Sub
End Class
-------------------------------------------------------------------------------------------------------------------------
Public Class Form033B_36109019
Dim wahyuni As New ByIskandar.CariKeDataBaseByIskandar
Dim cm As New OleDb.OleDbCommand
Dim uni As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub indonesia()
If t1_36109019.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If t2_36109019.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t3_36109019.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t4_36109019.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
End Sub
Private Sub tambah()
indonesia()
wahyuni.AturPencarianDataBase("Barang", "KodeBarang", t1_36109019.Text, 1, uni)
If wahyuni.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
cm = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_36109019.Text & "','" & t2_36109019.Text & "'," & Val(t3_36109019.Text) & "," & Val(t4_36109019.Text) & ")", uni)
uni.Open()
cm.ExecuteNonQuery()
uni.Close()
cm.Dispose()
t1_36109019.Text = ""
t2_36109019.Text = ""
t3_36109019.Text = ""
t4_36109019.Text = ""
Form033A_36109019.wahyuni()
End Sub
Private Sub edit()
indonesia()
If t1_36109019.Text <> KB.Text Then
wahyuni.AturPencarianDataBase("Barang", "KodeBarang", t1_36109019.Text, 1, uni)
If wahyuni.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
End If
cm = New OleDb.OleDbCommand("update barang set kodebarang = '" & t1_36109019.Text & "', namabarang = '" & t2_36109019.Text & "', hargajual = " & Val(t3_36109019.Text) & ", jumlahbarang = " & Val(t4_36109019.Text) & " where kodebarang = '" & KB.Text & "'", uni)
uni.Open()
cm.ExecuteNonQuery()
uni.Close()
cm.Dispose()
t1_36109019.Text = ""
t2_36109019.Text = ""
t3_36109019.Text = ""
t4_36109019.Text = ""
KB.Text = "-"
Form033A_36109019.wahyuni()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If KB.Text = "-" Then
tambah()
Else
edit()
End If
End Sub
End Class
-------------------------------------------------------------------------------------------------------------------------
Public Class Form034A_36109019
Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click
If Form034B_36109019.Visible = False Then
Form034B_36109019.MdiParent = Me
Form034B_36109019.Show()
Else
Form034B_36109019.Activate()
End If
End Sub
Private Sub ToolStripButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click
If Form034C_36109019.Visible = False Then
Form034C_36109019.MdiParent = Me
Form034C_36109019.Show()
Else
Form034C_36109019.Activate()
End If
End Sub
Private Sub INPUTBARANGToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles INPUTBARANGToolStripMenuItem.Click
If Form034C_36109019.Visible = False Then
Form034C_36109019.MdiParent = Me
Form034C_36109019.Show()
Else
Form034C_36109019.Activate()
End If
End Sub
Private Sub DAFTARBARANGToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DAFTARBARANGToolStripMenuItem.Click
If Form034B_36109019.Visible = False Then
Form034B_36109019.MdiParent = Me
Form034B_36109019.Show()
Else
Form034B_36109019.Activate()
End If
End Sub
End Class
-------------------------------------------------------------------------------------------------------------------------
Public Class Form034B_36109019
Dim dt As New DataTable
Dim cm As New OleDb.OleDbCommand
Dim uni As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub wahyuni()
Dim a As New OleDb.OleDbDataAdapter
a = New OleDb.OleDbDataAdapter("select * from barang", uni)
dt.Rows.Clear()
a.Fill(dt)
a.Dispose()
End Sub
Private Sub Form034B_36109019_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
wahyuni()
dgv.DataSource = dt
End Sub
Private Sub tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tambah.Click
If Form034C_36109019.Visible = False Then
Form034C_36109019.MdiParent = Me.MdiParent
Form034C_36109019.Show()
Else
Form034C_36109019.Activate()
End If
Form034C_36109019.t1_36109019.Text = dgv.CurrentRow.Cells("kodebarang").Value
Form034C_36109019.t2_36109019.Text = dgv.CurrentRow.Cells("namabarang").Value
Form034C_36109019.t3_36109019.Text = dgv.CurrentRow.Cells("hargajual").Value
Form034C_36109019.t4_36109019.Text = dgv.CurrentRow.Cells("jumlahbarang").Value
Form034C_36109019.KB.Text = dgv.CurrentRow.Cells("kodebarang").Value
Form034C_36109019.Show()
End Sub
Private Sub edit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles edit.Click
If Form034C_36109019.Visible = False Then
Form034C_36109019.MdiParent = Me.MdiParent
Form034C_36109019.Show()
Else
Form034C_36109019.Activate()
End If
Form034C_36109019.t1_36109019.Text = dgv.CurrentRow.Cells("kodebarang").Value
Form034C_36109019.t2_36109019.Text = dgv.CurrentRow.Cells("namabarang").Value
Form034C_36109019.t3_36109019.Text = dgv.CurrentRow.Cells("hargajual").Value
Form034C_36109019.t4_36109019.Text = dgv.CurrentRow.Cells("jumlahbarang").Value
Form034C_36109019.KB.Text = dgv.CurrentRow.Cells("kodebarang").Value
Form034C_36109019.Show()
End Sub
Private Sub hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus.Click
cm = New OleDb.OleDbCommand("delete * from barang where kodebarang = '" & dgv.CurrentRow.Cells("kodebarang").Value & "'", uni)
uni.Open()
cm.ExecuteNonQuery()
uni.Close()
cm.Dispose()
wahyuni()
End Sub
End Class
-------------------------------------------------------------------------------------------------------------------------
Public Class Form034C_36109019
Dim wahyuni As New ByIskandar.CariKeDataBaseByIskandar
Dim cm As New OleDb.OleDbCommand
Dim uni As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub indonesia()
If t1_36109019.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If t2_36109019.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t3_36109019.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t4_36109019.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
End Sub
Private Sub tambah()
indonesia()
wahyuni.AturPencarianDataBase("Barang", "KodeBarang", t1_36109019.Text, 1, uni)
If wahyuni.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
cm = New OleDb.OleDbCommand("insert into barang(kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_36109019.Text & "','" & t2_36109019.Text & "'," & Val(t3_36109019.Text) & "," & Val(t4_36109019.Text) & ")", uni)
uni.Open()
cm.ExecuteNonQuery()
uni.Close()
cm.Dispose()
t1_36109019.Text = ""
t2_36109019.Text = ""
t3_36109019.Text = ""
t4_36109019.Text = ""
Form034B_36109019.wahyuni()
End Sub
Private Sub edit()
indonesia()
If t1_36109019.Text <> KB.Text Then
wahyuni.AturPencarianDataBase("Barang", "KodeBarang", t1_36109019.Text, 1, uni)
If wahyuni.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
End If
cm = New OleDb.OleDbCommand("update barang set kodebarang = '" & t1_36109019.Text & "', namabarang = '" & t2_36109019.Text & "', hargajual = " & Val(t3_36109019.Text) & ", jumlahbarang = " & Val(t4_36109019.Text) & " where kodebarang = '" & KB.Text & "'", uni)
uni.Open()
cm.ExecuteNonQuery()
uni.Close()
cm.Dispose()
t1_36109019.Text = ""
t2_36109019.Text = ""
t3_36109019.Text = ""
t4_36109019.Text = ""
KB.Text = "-"
Form034B_36109019.wahyuni()
End Sub
Private Sub simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan.Click
If KB.Text = "-" Then
tambah()
Else
edit()
End If
End Sub
End Class
Tidak ada komentar:
Posting Komentar