Kamis, 24 November 2011

Form 32A-34C

Public Class Form32A
    Dim dt As New DataTable
    Dim conect As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
    Public Sub ami()
        Dim fm As New OleDb.OleDbDataAdapter
        fm = New OleDb.OleDbDataAdapter("select * from barang", conect)
        dt.Rows.Clear()
        fm.Fill(dt)
        fm.Dispose()
    End Sub
    Private Sub latihan32A_36109017_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ami()
        dgv_021.DataSource = dt
    End Sub

    Private Sub button1_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1_021.Click
        If Form32B.Visible = False Then
            Form32B.Show()
        Else
            Form32B.Activate()
        End If
    End Sub

    Private Sub button2_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button2_021.Click
        If Form32C.Visible = False Then
            Form32C.Show()
        Else
            Form32C.Activate()
        End If

        Form32C.t1_021.Text = dgv_021.CurrentRow.Cells("kodebarang").Value
        Form32C.t2_021.Text = dgv_021.CurrentRow.Cells("namabarang").Value
        Form32C.t3_021.Text = dgv_021.CurrentRow.Cells("hargajual").Value
        Form32C.t4_021.Text = dgv_021.CurrentRow.Cells("jumlahbarang").Value
        Form32C.KB.Text = dgv_021.CurrentRow.Cells("kodebarang").Value

        Form32C.Show()
    End Sub
End Class








Public Class Form32B

    Dim ami As New ByIskandar.CariKeDataBaseByIskandar
    Dim nurul As New OleDb.OleDbCommand
    Dim conect As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")


    Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
        If t1_021.Text.Length = 0 Then
            MsgBox("Isi rong itu yang  kosong")
            Exit Sub
        End If

        If t2_021.Text.Length = 0 Then
            MsgBox("Isi rong itu yang kosong")
            Exit Sub
        End If

        If Val(t3_021.Text) = 0 Then
            MsgBox("Isi rong itu yang kosong")
            Exit Sub
        End If

        If Val(t4_021.Text) = 0 Then
            MsgBox("Isi rong itu yang kosong")
            Exit Sub
        End If

        ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, conect)
        If ami.JumlanBaris > 0 Then
            MsgBox("Adami kode barang seperti itu")
            Exit Sub
        End If

        nurul = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_021.Text & "','" & t2_021.Text & "'," & Val(t3_021.Text) & "," & Val(t4_021.Text) & ")", conect)
        conect.Open()
        nurul.ExecuteNonQuery()
        conect.Close()
        nurul.Dispose()

        t1_021.Text = ""
        t2_021.Text = ""
        t3_021.Text = ""
        t4_021.Text = ""

        Form32A.ami()

    End Sub
End Class






Public Class Form32C

    Dim ami As New ByIskandar.CariKeDataBaseByIskandar
    Dim nurul As New OleDb.OleDbCommand
    Dim conect As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")

    Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
        If t1_021.Text.Length = 0 Then
            MsgBox("Isi rong itu yang kosong")
            Exit Sub
        End If

        If t2_021.Text.Length = 0 Then
            MsgBox("Isi rong itu yang kosong")
            Exit Sub
        End If

        If Val(t3_021.Text) = 0 Then
            MsgBox("Isi rong itu yang kosong")
            Exit Sub
        End If

        If Val(t4_021.Text) = 0 Then
            MsgBox("Isi rong itu yang kosong")
            Exit Sub
        End If

        If t1_021.Text <> KB.Text Then
            ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, conect)
            If ami.JumlanBaris > 0 Then
                MsgBox("Adami kode barang seperti itu")
                Exit Sub
            End If
        End If

        nurul = New OleDb.OleDbCommand("update barang set kodebarang = '" & t1_021.Text & "', namabarang = '" & t2_021.Text & "', hargajual = " & Val(t3_021.Text) & ", jumlahbarang = " & Val(t4_021.Text) & " where kodebarang = '" & KB.Text & "'", conect)

        conect.Open()
        nurul.ExecuteNonQuery()
        conect.Close()
        nurul.Dispose()

        t1_021.Text = ""
        t2_021.Text = ""
        t3_021.Text = ""
        t4_021.Text = ""
        KB.Text = ""

        Form32A.ami()
    End Sub
End Class





Public Class Form33A

    Dim ami As New DataTable
    Dim nurul As New OleDb.OleDbCommand
    Dim irma As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DATABARANG.accdb'")

    Private Sub button2_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button2_021.Click
        If Form33B.Visible = False Then
            Form33B.Show()
        Else
            Form33B.Activate()
        End If
    End Sub

    Private Sub button3_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button3_021.Click
        If Form33B.Visible = False Then
            Form33B.Show()
        Else
            Form33B.Activate()
        End If
        Form33B.KB.Text = dgv_021.CurrentRow.Cells("kodebarang").Value
        Form33B.t1_021.Text = dgv_021.CurrentRow.Cells("kodebarang").Value
        Form33B.t2_021.Text = dgv_021.CurrentRow.Cells("namabarang").Value
        Form33B.t3_021.Text = dgv_021.CurrentRow.Cells("hargajual").Value
        Form33B.t4_021.Text = dgv_021.CurrentRow.Cells("jumlahbarang").Value
    End Sub

    Private Sub Form33A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim adapter As New OleDb.OleDbDataAdapter
        adapter = New OleDb.OleDbDataAdapter("select * from barang", irma)
        ami.Rows.Clear()
        adapter.Fill(ami)
        adapter.Dispose()
        dgv_021.DataSource = ami
    End Sub

    Private Sub button1_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1_021.Click
        Dim ara As String = "delete * from barang where kodebarang = '" & dgv_021.CurrentRow.Cells("kodebarang").Value & "'"
        nurul = New OleDb.OleDbCommand(ara, irma)
        irma.Open()
        nurul.ExecuteNonQuery()
        irma.Close()
        nurul.Dispose()

        Dim adapter As New OleDb.OleDbDataAdapter
        adapter = New OleDb.OleDbDataAdapter("select * from barang", irma)
        ami.Rows.Clear()
        adapter.Fill(ami)
        adapter.Dispose()
        dgv_021.DataSource = ami
    End Sub
End Class









Public Class Form33B

    Dim ami As New ByIskandar.CariKeDataBaseByIskandar
    Dim nurul As New OleDb.OleDbCommand
    Dim irma As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DATABARANG.accdb'")

    Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
        If KB.Text = "" Then
            ami.AturPencarianDataBase("Barang", "KodeBarang", KB.Text, 1, irma)
            If ami.JumlanBaris > 0 Then
                MsgBox("kode barang telah ada")
                t1_021.Text = ""
                Exit Sub
            ElseIf t1_021.Text.Length = 0 Then
                MsgBox("kode barang harus tercantum")
                Exit Sub
            ElseIf t2_021.Text.Length = 0 Then
                MsgBox("nama barang harus tercantum")
                Exit Sub
            ElseIf t3_021.Text.Length = 0 Then
                MsgBox("harga jual harus tercantum")
                Exit Sub
            ElseIf t4_021.Text.Length = 0 Then
                MsgBox("jumlah barang harus tercantum")
                Exit Sub
            End If
            Dim soe As String = "insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_021.Text & "','" & t2_021.Text & "'," & Val(t3_021.Text) & "," & Val(t4_021.Text) & ")"
            nurul = New OleDb.OleDbCommand(soe, irma)
            irma.Open()
            nurul.ExecuteNonQuery()
            irma.Close()
            nurul.Dispose()
            t1_021.Text = ""
            t2_021.Text = ""
            t3_021.Text = ""
            t4_021.Text = ""
        Else
            If KB.Text <> t1_021.Text Then
                ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
                If ami.JumlanBaris > 0 Then
                    MsgBox("kode barang tidak dapat diupdate")
                    Exit Sub
                End If
            End If
            If t1_021.Text.Length = 0 Then
                MsgBox("kode barang harus tercantum")
                Exit Sub
            ElseIf t2_021.Text.Length = 0 Then
                MsgBox("nama barang harus tercantum")
                Exit Sub
            ElseIf t3_021.Text.Length = 0 Then
                MsgBox("harga jual harus tercantum")
                Exit Sub
            ElseIf t4_021.Text.Length = 0 Then
                MsgBox("jumlah barang harus tercantum")
                Exit Sub
            End If
            Dim soe As String = "update barang set kodebarang = '" & t1_021.Text & "', namabarang = '" & t2_021.Text & "', hargajual = " & Val(t3_021.Text) & ", jumlahbarang = " & Val(t4_021.Text) & " where kodebarang = '" & KB.Text & "'"
            nurul = New OleDb.OleDbCommand(soe, irma)
            irma.Open()
            nurul.ExecuteNonQuery()
            irma.Close()
            nurul.Dispose()
            KB.Text = "-"
            t1_021.Text = ""
            t2_021.Text = ""
            t3_021.Text = ""
            t4_021.Text = ""
        End If
    End Sub
End Class







Public Class Form34A

    Private Sub DATABARANGToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DAFTARBARANGToolStripMenuItem.Click
        If Form34B.Visible = False Then
            Form34B.MdiParent = Me
            Form34B.Show()
        Else
            Form34B.Activate()
        End If
    End Sub
    Private Sub INPUTBARANGToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles INPUTBARANGToolStripMenuItem.Click
        If Form34C.Visible = False Then
            Form34C.MdiParent = Me
            Form34C.Show()
        Else
            Form34C.Activate()
        End If

    End Sub
    Private Sub ToolStripButton1_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1_021.Click
        If Form34B.Visible = False Then
            Form34B.MdiParent = Me
            Form34B.Show()
        Else
            Form34B.Activate()
        End If

    End Sub
    Private Sub ToolStripButton2_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2_021.Click
        If Form34C.Visible = False Then
            Form34C.MdiParent = Me
            Form34C.Show()
        Else
            Form34B.Activate()
        End If
    End Sub
End Class







Public Class Form34B

    Dim DT As New DataTable
    Dim CM As New OleDb.OleDbCommand
    Dim MM As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
    Private Sub button2_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button2_021.Click
        If Form34C.Visible = False Then
            Form34C.Show()
        Else
            Form34C.Activate()
        End If
    End Sub
    Private Sub button3_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button3_021.Click
        If Form34C.Visible = False Then
            Form34C.Show()
        Else
            Form34C.Activate()
        End If
        Form34C.t1_021.Text = dgv_021.CurrentRow.Cells("kodebarang").Value
        Form34C.t2_021.Text = dgv_021.CurrentRow.Cells("namabarang").Value
        Form34C.t3_021.Text = dgv_021.CurrentRow.Cells("hargajual").Value
        Form34C.t4_021.Text = dgv_021.CurrentRow.Cells("jumlahbarang").Value
        Form34C.KB.Text = dgv_021.CurrentRow.Cells("kodebarang").Value
    End Sub
    Private Sub button1_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1_021.Click
        Dim ICHMI As String = "delete * from barang where kodebarang = '" & dgv_021.CurrentRow.Cells("kodebarang").Value & "'"
        CM = New OleDb.OleDbCommand(ICHMI, MM)
        MM.Open()
        CM.ExecuteNonQuery()
        MM.Close()
        CM.Dispose()

        Dim MILK As New OleDb.OleDbDataAdapter
        MILK = New OleDb.OleDbDataAdapter("select * from barang", MM)
        DT.Rows.Clear()
        MILK.Fill(DT)
        MILK.Dispose()
        dgv_021.DataSource = DT
    End Sub
    Private Sub Form34B_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim MILK As New OleDb.OleDbDataAdapter
        MILK = New OleDb.OleDbDataAdapter("Select * from barang", MM)
        DT.Rows.Clear()
        MILK.Fill(DT)
        MILK.Dispose()
        dgv_021.DataSource = DT
    End Sub
End Class






Public Class Form34C

    Dim ami As New ByIskandar.CariKeDataBaseByIskandar
    Dim OD As New OleDb.OleDbCommand
    Dim DB As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
    Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
        If KB.Text = "" Then
            ami.AturPencarianDataBase("Barang", "KodeBArang", t1_021.Text, 1, DB)
            If ami.JumlanBaris > 0 Then
                MsgBox("Kode barang sudah ada")
                t1_021.Text = ""
                Exit Sub
            ElseIf t1_021.Text.Length = 0 Then
                MsgBox("Kode barang harus ada")
                Exit Sub
            ElseIf t2_021.Text.Length = 0 Then
                MsgBox("Kode barang harus ada")
                Exit Sub
            ElseIf t3_021.Text.Length = 0 Then
                MsgBox("Kode barang harus ada")
                Exit Sub
            ElseIf t4_021.Text.Length = 0 Then
                MsgBox("Kode barang harus ada")
                Exit Sub
            End If

            Dim nurul As String = "insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_021.Text & "','" & t2_021.Text & "'," & Val(t3_021.Text) & "," & Val(t4_021.Text) & ")"
            OD = New OleDb.OleDbCommand(nurul, DB)
            DB.Open()
            OD.ExecuteNonQuery()
            DB.Close()
            OD.Dispose()
            t1_021.Text = ""
            t2_021.Text = ""
            t3_021.Text = ""
            t4_021.Text = ""
        Else
            If KB.Text <> t1_021.Text Then
                ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, DB)
                If ami.JumlanBaris > 0 Then
                    MsgBox("Kode barang sudah ada")
                    Exit Sub
                End If
            End If
            If t1_021.Text.Length = 0 Then
                MsgBox("Kode barang harus ada")
                Exit Sub
            ElseIf t2_021.Text.Length = 0 Then
                MsgBox("Kode barang harus ada")
                Exit Sub
            ElseIf Val(t3_021.Text) = 0 Then
                MsgBox("Kode barang harus ada")
                Exit Sub
            ElseIf Val(t4_021.Text) = 0 Then
                MsgBox("Kode barang harus ada")
                Exit Sub
            End If

            Dim nurul As String = "update barang set kodebarang = '" & t1_021.Text & "', namabarang = '" & t2_021.Text & "', hargajual = " & Val(t3_021.Text) & ", jumlahbarang = " & Val(t4_021.Text) & " where kodebarang = '" & KB.Text & "'"
            OD = New OleDb.OleDbCommand(nurul, DB)
            DB.Open()
            OD.ExecuteNonQuery()
            DB.Close()
            OD.Dispose()
            KB.Text = "-"
            t1_021.Text = ""
            t2_021.Text = ""
            t3_021.Text = ""
            t4_021.Text = ""
        End If
    End Sub
End Class

Form 27-31B

Public Class Form27

    Dim ami As New ByIskandar.CariKeDataBaseByIskandar
    Dim nurul As New OleDb.OleDbCommand
    Dim irma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")

    Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
        If t1_021.Text.Length = 0 Then
            MsgBox("masukkan teks")
            Exit Sub
        End If

        If t2_021.Text.Length = 0 Then
            MsgBox("masukkan teks")
            Exit Sub
        End If

        If Val(t3_021.Text) = 0 Then
            MsgBox("masukkan teks")
            Exit Sub
        End If

        If Val(t4_021.Text) = 0 Then
            MsgBox("masukkan teks")
            Exit Sub
        End If

        Dim search As New ByIskandar.CariKeDataBaseByIskandar
        search.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
        If search.JumlanBaris > 0 Then
            MsgBox("kode barang sudah ada")
            t1_021.Text = ""
            t2_021.Text = ""
            t3_021.Text = ""
            t4_021.Text = ""
            Exit Sub
        End If

        Dim cm = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_021.Text & "','" & t2_021.Text & "'," & Val(t3_021.Text) & "," & Val(t4_021.Text) & ")", irma)
        irma.Open()
        cm.ExecuteNonQuery()
        irma.Close()
        cm.Dispose()

        t1_021.Text = ""
        t2_021.Text = ""
        t3_021.Text = ""
        t4_021.Text = ""
    End Sub
End Class



Public Class Form28A

    Dim ar As New DataTable
    Dim nurul As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")

    Public Sub ami()
        Dim am As New OleDb.OleDbDataAdapter
        am = New OleDb.OleDbDataAdapter("select * from barang", nurul)
        ar.Rows.Clear()
        am.Fill(ar)
        am.Dispose()
    End Sub
    Private Sub Form28A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ami()
        dgv_021.DataSource = ar
    End Sub

    Private Sub button1_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1_021.Click
        If Form28B.Visible = False Then
            Form28B.Show()
        Else
            Form28B.Activate()
        End If
    End Sub

    Private Sub button2_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button2_021.Click
        Close()
    End Sub
End Class





Public Class Form28B

    Dim ami As New ByIskandar.CariKeDataBaseByIskandar
    Dim nurul As New OleDb.OleDbCommand
    Dim irma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")

    Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
        If t1_021.Text.Length = 0 Then
            MsgBox("Masukkan teks")
            Exit Sub
        End If

        If t2_021.Text.Length = 0 Then
            MsgBox("Masukkan teks")
            Exit Sub
        End If

        If Val(t3_021.Text) = 0 Then
            MsgBox("Masukkan teks")
            Exit Sub
        End If

        If Val(t4_021.Text) = 0 Then
            MsgBox("Masukkan teks")
            Exit Sub
        End If

        Dim search As New ByIskandar.CariKeDataBaseByIskandar
        search.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
        If search.JumlanBaris > 0 Then
            MsgBox("Data sudah dimasukkan")
            Exit Sub
        End If

        Dim cm = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_021.Text & "','" & t2_021.Text & "'," & Val(t3_021.Text) & "," & Val(t4_021.Text) & ")", irma)
        irma.Open()
        cm.ExecuteNonQuery()
        irma.Close()
        cm.Dispose()

        t1_021.Text = ""
        t2_021.Text = ""
        t3_021.Text = ""
        t4_021.Text = ""


    End Sub
End Class






Public Class Form29

    Dim ar As New OleDb.OleDbCommand
    Dim ami As New ByIskandar.CariKeDataBaseByIskandar
    Dim irma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")

    Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
        If t1_021.Text.Length = 0 Then
            MsgBox("masukkan teks")
            Exit Sub
        End If

        If t2_021.Text.Length = 0 Then
            MsgBox("masukkan teks")
            Exit Sub
        End If

        If Val(t3_021.Text) = 0 Then
            MsgBox("masukkan teks")
            Exit Sub
        End If

        If Val(t4_021.Text) = 0 Then
            MsgBox("masukkan teks")
            Exit Sub
        End If

        If kb_021.Text <> t1_021.Text Then

            ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
            If ami.JumlanBaris > 0 Then
                MsgBox("Kode barang sudah ada")
                Exit Sub
            End If
        End If

        ar = New OleDb.OleDbCommand("update barang set kodebarang = '" & t1_021.Text & "', namabarang = '" & t2_021.Text & "', hargajual = " & Val(t3_021.Text) & ", jumlahbarang = " & Val(t4_021.Text) & " where kodebarang = '" & kb_021.Text & "'", irma)
        irma.Open()
        ar.ExecuteNonQuery()
        irma.Close()
        ar.Dispose()

        kb_021.Text = ""
        t1_021.Text = ""
        t2_021.Text = ""
        t3_021.Text = ""
        ts4_021.Text = ""
    End Sub
End Class







Public Class Form30A

    Dim ar As New DataTable
    Dim irma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")

    Public Sub ami()
        Dim mee As New OleDb.OleDbDataAdapter
        mee = New OleDb.OleDbDataAdapter("select * from barang", irma)
        ar.Rows.Clear()
        mee.Fill(ar)
        mee.Dispose()
    End Sub

    Private Sub Form30A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ami()
        dgv_021.DataSource = ar
    End Sub

    Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
        If Form30B.Visible = False Then
            Form30B.Show()
        Else
            Form30B.Activate()
        End If

        Form30B.kb_021.Text = dgv_021.CurrentRow.Cells("kodebarang").Value
        Form30B.t1_021.Text = dgv_021.CurrentRow.Cells("kodebarang").Value
        Form30B.t2_021.Text = dgv_021.CurrentRow.Cells("namabarang").Value
        Form30B.t3_021.Text = dgv_021.CurrentRow.Cells("hargajual").Value
        Form30B.t4_021.Text = dgv_021.CurrentRow.Cells("jumlahbarang").Value

        Form30B.Show()
    End Sub
End Class










Public Class Form30B

    Dim ami As New ByIskandar.CariKeDataBaseByIskandar
    Dim ar As New OleDb.OleDbCommand
    Dim irma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")

    Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
        If t1_021.Text.Length = 0 Then
            MsgBox("masukkan teks")
            Exit Sub
        End If

        If t2_021.Text.Length = 0 Then
            MsgBox("masukkan teks")
            Exit Sub
        End If

        If Val(t3_021.Text) = 0 Then
            MsgBox("masukkan teks")
            Exit Sub
        End If

        If Val(t4_021.Text) = 0 Then
            MsgBox("masukkan teks")
            Exit Sub
        End If

        If kb_021.Text <> t1_021.Text Then
            ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
            If ami.JumlanBaris > 0 Then
                MsgBox("Kode barang sudah ada")
                Exit Sub
            End If
        End If

        ar = New OleDb.OleDbCommand("update barang set kodebarang = '" & t1_021.Text & "', namabarang = '" & t2_021.Text & "', hargajual = " & Val(t3_021.Text) & ", jumlahbarang = " & Val(t4_021.Text) & " where kodebarang = '" & kb_021.Text & "'", irma)

        irma.Open()
        ar.ExecuteNonQuery()
        irma.Close()
        ar.Dispose()

        kb_021.Text = ""
        t1_021.Text = ""
        t2_021.Text = ""
        t3_021.Text = ""
        t4_021.Text = ""

        Form30A.ami()
    End Sub
End Class






Public Class Form30B

    Dim ami As New ByIskandar.CariKeDataBaseByIskandar
    Dim ar As New OleDb.OleDbCommand
    Dim irma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")

    Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
        If t1_021.Text.Length = 0 Then
            MsgBox("masukkan teks")
            Exit Sub
        End If

        If t2_021.Text.Length = 0 Then
            MsgBox("masukkan teks")
            Exit Sub
        End If

        If Val(t3_021.Text) = 0 Then
            MsgBox("masukkan teks")
            Exit Sub
        End If

        If Val(t4_021.Text) = 0 Then
            MsgBox("masukkan teks")
            Exit Sub
        End If

        If kb_021.Text <> t1_021.Text Then
            ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
            If ami.JumlanBaris > 0 Then
                MsgBox("Kode barang sudah ada")
                Exit Sub
            End If
        End If

        ar = New OleDb.OleDbCommand("update barang set kodebarang = '" & t1_021.Text & "', namabarang = '" & t2_021.Text & "', hargajual = " & Val(t3_021.Text) & ", jumlahbarang = " & Val(t4_021.Text) & " where kodebarang = '" & kb_021.Text & "'", irma)

        irma.Open()
        ar.ExecuteNonQuery()
        irma.Close()
        ar.Dispose()

        kb_021.Text = ""
        t1_021.Text = ""
        t2_021.Text = ""
        t3_021.Text = ""
        t4_021.Text = ""

        Form30A.ami()
    End Sub
End Class






Public Class Form31B

    Dim ami As New ByIskandar.CariKeDataBaseByIskandar
    Dim nurul As New OleDb.OleDbCommand
    Dim irma As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DATABARANG.accdb'")

    Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
        If KB.Text <> t1_021.Text Then
            ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
            If ami.JumlanBaris > 0 Then
                MsgBox("kode barang tidak dapat diupdate")
                Exit Sub
            End If
        End If
        If t1_021.Text.Length = 0 Then
            MsgBox("kode barang harus tercantum")
            Exit Sub
        ElseIf t2_021.Text.Length = 0 Then
            MsgBox("nama barang harus tercantum")
            Exit Sub
        ElseIf t3_021.Text.Length = 0 Then
            MsgBox("harga jual harus tercantum")
            Exit Sub
        ElseIf t4_021.Text.Length = 0 Then
            MsgBox("jumlah barang harus tercantum")
            Exit Sub
        End If
        Dim ara As String = "update barang set kodebarang = '" & t1_021.Text & "', namabarang = '" & t2_021.Text & "', hargajual = " & Val(t3_021.Text) & ", jumlahbarang = " & Val(t4_021.Text) & " where kodebarang = '" & KB.Text & "'"
        nurul = New OleDb.OleDbCommand(ara, irma)
        irma.Open()
        nurul.ExecuteNonQuery()
        irma.Close()
        nurul.Dispose()
        KB.Text = "-"
        t1_021.Text = ""
        t2_021.Text = ""
        t3_021.Text = ""
        t4_021.Text = ""
    End Sub

End Class

Form 22-26B

Form 22
Public Class Form22

    Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DataTransaksiJualBeli.accdb")
    Dim hxh1 As New DataTable
    Dim hxh2 As New DataTable
    Dim ima As New DataSet
    Dim op1 As New BindingSource
    Dim op2 As New BindingSource
    Private Sub Form22_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim ami1 As New OleDb.OleDbDataAdapter
        Dim ami2 As New OleDb.OleDbDataAdapter
        ami1 = New OleDb.OleDbDataAdapter("select * from mastertransaksi", CONECT)
        ami1.Fill(hxh1)
        dgv1_021.DataSource = op1

        ami2 = New OleDb.OleDbDataAdapter("select * from query4", CONECT)
        ami2.Fill(hxh2)
        dgv2_021.DataSource = op2

        ima.Tables.Add(hxh1)
        ima.Tables.Add(hxh2)

        hxh1.TableName = "sembarang1"
        hxh2.TableName = "sembarang2"

        ima.Relations.Add(New DataRelation("AA", ima.Tables("sembarang1").Columns("notrans"), ima.Tables("sembarang2").Columns("notrans")))

        op1.DataSource = ima
        op1.DataMember = "sembarang1"
        op2.DataSource = op1
        op2.DataMember = "AA"
    End Sub
End Class


Form 23A
Public Class Form23A

    Dim dt As New DataTable
    Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source =" & Application.StartupPath & "\DataTransaksiJualBeli.accdb")
    Private Sub Form23A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim a As New OleDb.OleDbDataAdapter
        a = New OleDb.OleDbDataAdapter("select * from mastertransaksi", conect)
        a.Fill(dt)
        a.Dispose()
        dgv_021.DataSource = dt

    End Sub

    Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
        If Form23B.Visible = False Then
            Form23B.Show()
        Else
            Form23B.Activate()
        End If
        Form23B.t1_021.Text = dgv_021.CurrentRow.Cells("notrans").Value
        Form23B.t2_021.Text = dgv_021.CurrentRow.Cells("tanggaltransaksi").Value
        Form23B.t3_021.Text = dgv_021.CurrentRow.Cells("jenistransaksi").Value

        Form23B.mee(Form23B.t1_021.Text)

    End Sub
End Class


Form 23B
Public Class Form23B

    Dim koneksi As New OleDb.OleDbConnection("provider=microsoft.ACE.oledb.12.0;data source=" & Application.StartupPath & "\DataTransaksiJualBeli.accdb")
    Dim tabel As New DataTable

    Public Sub mee(ByVal A As String)
        Dim adapter As New OleDb.OleDbDataAdapter
        adapter = New OleDb.OleDbDataAdapter("select*from detailtransaksi where notrans='" & A & "'", koneksi)
        tabel.Rows.Clear()
        adapter.Fill(tabel)

        dgv_021.DataSource = tabel
    End Sub

    Private Sub Form23B_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class

Form 24A
Public Class Form24A

    Dim dt As New DataTable
    Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source =" & Application.StartupPath & "\DataTransaksiJualBeli.accdb")
    Private Sub Form23A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim ami As New OleDb.OleDbDataAdapter
        ami = New OleDb.OleDbDataAdapter("select * from BARANG", conect)
        ami.Fill(dt)
        ami.Dispose()
        dgv_021.DataSource = dt

    End Sub

    Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
        If Form24B.Visible = False Then
            Form24B.Show()
        Else
            Form23B.Activate()
        End If
        Form24B.t1_021.Text = dgv_021.CurrentRow.Cells("KODEBARANG").Value
        Form24B.t2_021.Text = dgv_021.CurrentRow.Cells("NAMABARANG").Value
        Form24B.t3_021.Text = dgv_021.CurrentRow.Cells("PERSEDIAANAWAL").Value
        Form24B.t4_021.Text = dgv_021.CurrentRow.Cells("HARGAJUAL").Value

        Form24B.mee(Form24B.t1_021.Text)

    End Sub
End Class


Form 24B
Public Class Form24B
    Dim conect As New OleDb.OleDbConnection("provider=microsoft.ACE.oledb.12.0;data source=" & Application.StartupPath & "\DataTransaksiJualBeli.accdb")
    Dim tabel As New DataTable

    Public Sub mee(ByVal A As String)
        Dim adapter As New OleDb.OleDbDataAdapter
        adapter = New OleDb.OleDbDataAdapter("select* from DETAILTRANSAKSI where KODEBARANG='" & A & "'", conect)
        tabel.Rows.Clear()
        adapter.Fill(tabel)

        dgv_021.DataSource = tabel
    End Sub
End Class



Form 25A
Public Class Form25A

    Dim conect As New OleDb.OleDbConnection("provider=microsoft.ACE.oledb.12.0;data source=" & Application.StartupPath & "\datatransaksijualbeli.accdb")
    Dim tabel As New DataTable

    Private Sub Form25A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim adapter As New OleDb.OleDbDataAdapter
        adapter = New OleDb.OleDbDataAdapter("select * from BARANG", conect)
        tabel.Rows.Clear()
        adapter.Fill(tabel)
        adapter.Dispose()

        dgv_021.DataSource = tabel

    End Sub

    Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
        If Form25B.Visible = False Then
            Form25B.Show()
        Else
            Form25B.Activate()
        End If

        Form25B.t1_021.Text = dgv_021.CurrentRow.Cells("KODEBARANG").Value
        Form25B.t2_021.Text = dgv_021.CurrentRow.Cells("NAMABARANG").Value
        Form25B.t3_021.Text = dgv_021.CurrentRow.Cells("HARGAJUAL").Value
        Form25B.t4_021.Text = dgv_021.CurrentRow.Cells("PERSEDIAANAWAL").Value

        Form25B.mee(Form25B.t1_021.Text)

    End Sub
End Class


Form 25B
Public Class Form25B

    Dim conect As New OleDb.OleDbConnection("provider=microsoft.ACE.oledb.12.0;data source=" & Application.StartupPath & "\DataTransaksiJualBeli.accdb")
    Dim ami As New DataTable

    Public Sub mee(ByVal A As String)
        Dim adapter As New OleDb.OleDbDataAdapter
        adapter = New OleDb.OleDbDataAdapter("select MASTERTRANSAKSI.NOTRANS, MASTERTRANSAKSI.TANGGALTRANSAKSI, MASTERTRANSAKSI.JENISTRANSAKSI, MASTERTRANSAKSI.KETERANGAN, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, [DETAILTRANSAKSI]![UNIT]*[DETAILTRANSAKSI]![HARGA] AS JUMLAH FROM DETAILTRANSAKSI INNER JOIN MASTERTRANSAKSI ON DETAILTRANSAKSI.NOTRANS=MASTERTRANSAKSI.NOTRANS WHERE KODEBARANG='" & A & "'", conect)
        ami.Rows.Clear()
        adapter.Fill(ami)
        adapter.Dispose()

        dgv_021.DataSource = ami
    End Sub
End Class


Form 26A
Public Class Form26A
    Dim conect As New OleDb.OleDbConnection("provider=microsoft.ACE.oledb.12.0;data source=" & Application.StartupPath & "\datatransaksijualbeli.accdb")
    Dim tabel As New DataTable

    Private Sub Form26A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim adapter As New OleDb.OleDbDataAdapter
        adapter = New OleDb.OleDbDataAdapter("select * from BARANG", conect)
        tabel.Rows.Clear()
        adapter.Fill(tabel)
        adapter.Dispose()

        dgv_021.DataSource = tabel

    End Sub

    Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
        If Form26B.Visible = False Then
            Form26B.Show()
        Else
            Form26B.Activate()
        End If

        Form26B.t1_021.Text = dgv_021.CurrentRow.Cells("KODEBARANG").Value
        Form26B.t2_021.Text = dgv_021.CurrentRow.Cells("NAMABARANG").Value
        Form26B.t3_021.Text = dgv_021.CurrentRow.Cells("HARGAJUAL").Value
        Form26B.t4_021.Text = dgv_021.CurrentRow.Cells("PERSEDIAANAWAL").Value

        Form26B.mee(Form26B.t1_021.Text)
    End Sub
End Class


Form 26B
Public Class Form26B
    Dim conect As New OleDb.OleDbConnection("provider=microsoft.ACE.oledb.12.0;data source=" & Application.StartupPath & "\DataTransaksiJualBeli.accdb")
    Dim ami As New DataTable

    Public Sub mee(ByVal A As String)
        Dim adapter As New OleDb.OleDbDataAdapter
        adapter = New OleDb.OleDbDataAdapter("select MASTERTRANSAKSI.NOTRANS, MASTERTRANSAKSI.TANGGALTRANSAKSI, MASTERTRANSAKSI.JENISTRANSAKSI, MASTERTRANSAKSI.KETERANGAN, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, [DETAILTRANSAKSI]![UNIT]*[DETAILTRANSAKSI]![HARGA] AS JUMLAH FROM DETAILTRANSAKSI INNER JOIN MASTERTRANSAKSI ON DETAILTRANSAKSI.NOTRANS=MASTERTRANSAKSI.NOTRANS WHERE KODEBARANG='" & A & "'", conect)
        ami.Rows.Clear()
        adapter.Fill(ami)
        adapter.Dispose()
        ar()

        dgv_021.DataSource = ami
    End Sub
    Private Sub ar()
        Dim TU As Integer
        Dim TJ As Integer
        For Each x As DataRow In ami.Rows
            TU = TU + x("Unit")
            TJ = TJ + x("Jumlah")
        Next
        t5_021.Text = TU
        t6_021.Text = TJ
    End Sub
End Class