Jumat, 04 November 2011

Latihan 32 Apkom 4 D3 C

19 komentar:

  1. FITRAH ADITYA HANAPI

    Public Class LATIHAN032A084
    Dim X As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
    Dim datat1 As New DataTable
    Public Sub Deriel()
    Dim A As New OleDb.OleDbDataAdapter
    A = New OleDb.OleDbDataAdapter("Select * From BARANG", X)
    datat1.Rows.Clear()
    A.Fill(datat1)
    A.Dispose()
    End Sub
    Private Sub LATIHAN032A084_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Deriel()
    dgv_084.DataSource = datat1
    End Sub

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

    LATIHAN032B084.Show()
    End Sub
    End Class


    Public Class LATIHAN032B084
    Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")


    Private Sub SIMPAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN.Click
    If kb_084.Text.Length = 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If

    If nb_084.Text.Length = 0 Then
    MsgBox("Nama barang sudah ada")
    Exit Sub
    End If

    If Val(hj_084.Text) = 0 Then
    MsgBox("Harga jual sudah ada")
    Exit Sub
    End If

    If Val(jb_084.Text) = 0 Then
    MsgBox("Jumlah barang sudah ada")
    Exit Sub
    End If

    Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
    pencari.AturPencarianDataBase("Barang", "Kodebarang", kb_084.Text, 1, A)
    If pencari.JumlanBaris > 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If

    Dim CM As New OleDb.OleDbCommand
    CM = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & kb_084.Text & "', '" & nb_084.Text & "', " & Val(hj_084.Text) & ", " & Val(jb_084.Text) & ")", A)
    A.Open()
    CM.ExecuteNonQuery()
    A.Close()
    CM.Dispose()

    kb_084.Text = ""
    nb_084.Text = ""
    hj_084.Text = ""
    jb_084.Text = ""

    LATIHAN032A084.Deriel()
    End Sub
    End Class

    BalasHapus
  2. Public Class LATIHAN032C084
    Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")


    Private Sub simpan_084_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_084.Click
    If KB1_084.Text.Length = 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If

    If kb_084.Text.Length = 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If

    If nb_084.Text.Length = 0 Then
    MsgBox("Nama barang sudah ada")
    Exit Sub
    End If

    If Val(hj_084.Text) = 0 Then
    MsgBox("Harga jual sudah ada")
    Exit Sub
    End If

    If Val(jb_084.Text) = 0 Then
    MsgBox("Jumlah barang sudah ada")
    Exit Sub
    End If

    If KB1_084.Text <> kb_084.Text Then
    Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
    pencari.AturPencarianDataBase("Barang", "Kodebarang", kb_084.Text, 1, A)
    If pencari.JumlanBaris > 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If
    End If

    Dim CM As New OleDb.OleDbCommand
    CM = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & kb_084.Text & "', NAMABARANG= '" & nb_084.Text & "', HARGAJUAL= " & Val(hj_084.Text) & ", JUMLAHBARANG= " & Val(jb_084.Text) & " WHERE KODEBARANG='" & KB1_084.Text & "'", A)
    A.Open()
    CM.ExecuteNonQuery()
    A.Close()
    CM.Dispose()

    KB1_084.Text = "-"
    kb_084.Text = ""
    nb_084.Text = ""
    hj_084.Text = ""
    jb_084.Text = ""

    LATIHAN032A084.Deriel()
    End Sub
    End Class

    BalasHapus
  3. feby winiani syam

    Public Class Form32A
    Dim X As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
    Dim dt1 As New DataTable

    Public Sub feby()
    Dim A As New OleDb.OleDbDataAdapter
    A = New OleDb.OleDbDataAdapter("Select * From BARANG", X)
    dt1.Rows.Clear()
    A.Fill(dt1)
    A.Dispose()
    End Sub

    Private Sub Form32A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    feby()
    DGV_064.DataSource = dt1
    End Sub

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

    Form32B.Show()

    End Sub

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

    Form32C.Show()
    Form32C.KBrg1.Text = DGV_064.CurrentRow.Cells("Kodebarang").Value
    Form32C.KB_064.Text = DGV_064.CurrentRow.Cells("Kodebarang").Value
    Form32C.NB_064.Text = DGV_064.CurrentRow.Cells("Namabarang").Value
    Form32C.HJ_064.Text = DGV_064.CurrentRow.Cells("Hargajual").Value
    Form32C.JB_064.Text = DGV_064.CurrentRow.Cells("Jumlahbarang").Value
    End Sub

    End Class


    Public Class Form32B
    Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")

    Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles save.Click
    If KB_064.Text.Length = 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If

    If NB_064.Text.Length = 0 Then
    MsgBox("Nama barang sudah ada")
    Exit Sub
    End If

    If Val(HJ_064.Text) = 0 Then
    MsgBox("Harga jual sudah ada")
    Exit Sub
    End If

    If Val(JB_064.Text) = 0 Then
    MsgBox("Jumlah barang sudah ada")
    Exit Sub
    End If

    Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
    pencari.AturPencarianDataBase("Barang", "Kodebarang", KB_064.Text, 1, A)
    If pencari.JumlanBaris > 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If

    Dim CM As New OleDb.OleDbCommand
    CM = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & KB_064.Text & "', '" & NB_064.Text & "', " & Val(HJ_064.Text) & ", " & Val(JB_064.Text) & ")", A)
    A.Open()
    CM.ExecuteNonQuery()
    A.Close()
    CM.Dispose()

    KB_064.Text = ""
    NB_064.Text = ""
    HJ_064.Text = ""
    JB_064.Text = ""

    Form32A.feby()
    End Sub

    End Class

    BalasHapus
  4. Public Class Form32C
    Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")

    Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Save.Click
    If KBrg1.Text.Length = 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If

    If KB_064.Text.Length = 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If

    If NB_064.Text.Length = 0 Then
    MsgBox("Nama barang sudah ada")
    Exit Sub
    End If

    If Val(HJ_064.Text) = 0 Then
    MsgBox("Harga jual sudah ada")
    Exit Sub
    End If

    If Val(JB_064.Text) = 0 Then
    MsgBox("Jumlah barang sudah ada")
    Exit Sub
    End If

    If KBrg1.Text <> KB_064.Text Then
    Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
    pencari.AturPencarianDataBase("Barang", "Kodebarang", KB_064.Text, 1, A)
    If pencari.JumlanBaris > 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If
    End If

    Dim CM As New OleDb.OleDbCommand
    CM = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & KB_064.Text & "', NAMABARANG= '" & NB_064.Text & "', HARGAJUAL= " & Val(HJ_064.Text) & ", JUMLAHBARANG= " & Val(JB_064.Text) & " WHERE KODEBARANG='" & KBrg1.Text & "'", A)
    A.Open()
    CM.ExecuteNonQuery()
    A.Close()
    CM.Dispose()

    KBrg1.Text = "-"
    KB_064.Text = ""
    NB_064.Text = ""
    HJ_064.Text = ""
    JB_064.Text = ""

    Form32A.feby()
    End Sub

    End Class

    BalasHapus
  5. Public Class Form32A

    Dim X As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
    Dim dt1 As New DataTable

    Public Sub PUTRA()
    Dim A As New OleDb.OleDbDataAdapter
    A = New OleDb.OleDbDataAdapter("Select * From BARANG", X)
    dt1.Rows.Clear()
    A.Fill(dt1)
    A.Dispose()
    End Sub

    Private Sub Form32A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    PUTRA()
    DGV_076.DataSource = dt1
    End Sub

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

    Form32B.Show()

    End Sub

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

    Form32C.Show()
    Form32C.KBrg1.Text = DGV_076.CurrentRow.Cells("Kodebarang").Value
    Form32C.KB_076.Text = DGV_076.CurrentRow.Cells("Kodebarang").Value
    Form32C.NB_076.Text = DGV_076.CurrentRow.Cells("Namabarang").Value
    Form32C.HJ_076.Text = DGV_076.CurrentRow.Cells("Hargajual").Value
    Form32C.JB_076.Text = DGV_076.CurrentRow.Cells("Jumlahbarang").Value
    End Sub
    End Class

    Public Class Form32B
    Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")

    Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan.Click
    If KB_076.Text.Length = 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If

    If NB_076.Text.Length = 0 Then
    MsgBox("Nama barang sudah ada")
    Exit Sub
    End If

    If Val(HJ_076.Text) = 0 Then
    MsgBox("Harga jual sudah ada")
    Exit Sub
    End If

    If Val(JB_076.Text) = 0 Then
    MsgBox("Jumlah barang sudah ada")
    Exit Sub
    End If

    Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
    pencari.AturPencarianDataBase("Barang", "Kodebarang", KB_076.Text, 1, A)
    If pencari.JumlanBaris > 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If

    Dim CM As New OleDb.OleDbCommand
    CM = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & KB_076.Text & "', '" & NB_076.Text & "', " & Val(HJ_076.Text) & ", " & Val(JB_076.Text) & ")", A)
    A.Open()
    CM.ExecuteNonQuery()
    A.Close()
    CM.Dispose()

    KB_076.Text = ""
    NB_076.Text = ""
    HJ_076.Text = ""
    JB_076.Text = ""

    Form32A.PUTRA()
    End Sub
    End Class

    BalasHapus
  6. Public Class Form32C
    Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")

    Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan.Click
    If KBrg1.Text.Length = 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If

    If KB_076.Text.Length = 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If

    If NB_076.Text.Length = 0 Then
    MsgBox("Nama barang sudah ada")
    Exit Sub
    End If

    If Val(HJ_076.Text) = 0 Then
    MsgBox("Harga jual sudah ada")
    Exit Sub
    End If

    If Val(JB_076.Text) = 0 Then
    MsgBox("Jumlah barang sudah ada")
    Exit Sub
    End If

    If KBrg1.Text <> KB_076.Text Then
    Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
    pencari.AturPencarianDataBase("Barang", "Kodebarang", KB_076.Text, 1, A)
    If pencari.JumlanBaris > 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If
    End If

    Dim CM As New OleDb.OleDbCommand
    CM = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & KB_076.Text & "', NAMABARANG= '" & NB_076.Text & "', HARGAJUAL= " & Val(HJ_076.Text) & ", JUMLAHBARANG= " & Val(JB_076.Text) & " WHERE KODEBARANG='" & KBrg1.Text & "'", A)
    A.Open()
    CM.ExecuteNonQuery()
    A.Close()
    CM.Dispose()

    KBrg1.Text = "-"
    KB_076.Text = ""
    NB_076.Text = ""
    HJ_076.Text = ""
    JB_076.Text = ""

    Form32A.PUTRA()
    End Sub
    End Class

    BalasHapus
  7. Public Class Latihan32A_071
    Dim go As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source =" & Application.StartupPath & "\DataBarang.ACCDB")
    Dim take As New DataTable
    Public Sub ambildata()
    'mendeklarasikan adapter
    Dim data As New OleDb.OleDbDataAdapter

    'mengatur data yang akan diangkut
    data = New OleDb.OleDbDataAdapter("SELECT* from barang", go)

    'bersihkan data sebelum mengisi data lain
    take.Rows.Clear()

    'memasukkan data yg telah diambil ke dalam data grid view
    data.Fill(take)
    data.Dispose()
    End Sub

    Private Sub Latihan32A_071_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    ambildata()
    DGV_071.DataSource = take

    End Sub

    Private Sub tambah_071_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tambah_071.Click
    'menampilkan form 32b
    If latihan32b_071.Visible = False Then
    latihan32b_071.Show()
    Else
    latihan32b_071.Activate()
    End If

    Latihan32B_071.Show()

    End Sub

    Private Sub Edit_071_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Edit_071.Click
    'menampilkan form 32c
    If Latihan32C_071.Visible = False Then
    Latihan32C_071.Show()
    Else
    Latihan32C_071.Activate()
    End If
    Latihan32C_071.Show()
    Latihan32C_071.kbl_071.Text = DGV_071.CurrentRow.Cells("kodebarang").Value
    Latihan32C_071.kb_071.Text = DGV_071.CurrentRow.Cells("kodebarang").Value
    Latihan32C_071.nb_071.Text = DGV_071.CurrentRow.Cells("namabarang").Value
    Latihan32C_071.hj_071.Text = DGV_071.CurrentRow.Cells("hargajual").Value
    Latihan32C_071.jb_071.Text = DGV_071.CurrentRow.Cells("jumlahbarang").Value


    End Sub
    End Class

    BalasHapus
  8. Public Class Latihan32B_071
    Dim go 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
    'perintah periksa data
    If kb_071.Text.Length = 0 Then
    MsgBox("Please Insert Your Text")
    Exit Sub
    End If

    If nb_071.Text.Length = 0 Then
    MsgBox("Please Insert Your Text")
    Exit Sub
    End If

    If Val(hj_071.Text) = 0 Then
    MsgBox("Please Insert Your Text")
    Exit Sub
    End If

    If Val(jb_071.Text) = 0 Then
    MsgBox("Please Insert Your Text")
    Exit Sub
    End If

    'perintah ambil data
    Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
    PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", kb_071.Text, 1, go)

    If PENCARI.JumlanBaris > 0 Then
    MsgBox("The data has been exist please insert new data")

    'mengosongkan text box
    kb_071.Text = " "
    nb_071.Text = " "
    hj_071.Text = " "
    jb_071.Text = " "
    Exit Sub
    End If

    'deklarasi object command
    Dim Cm As New OleDb.OleDbCommand
    Cm = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & kb_071.Text & "','" & nb_071.Text & "', " & Val(hj_071.Text) & "," & Val(jb_071.Text) & ")", go)
    go.Open()
    Cm.ExecuteNonQuery()
    go.Close()
    Cm.Dispose()

    'mengosongkan text box
    kb_071.Text = " "
    nb_071.Text = " "
    hj_071.Text = " "
    jb_071.Text = " "

    'menjalankan procedure pengambilan data
    Latihan32A_071.ambildata()

    'menutup form
    Me.Close()

    End Sub
    End Class

    BalasHapus
  9. Public Class Latihan32C_071
    Dim go 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
    'perintah periksa data
    If kb_071.Text.Length = 0 Then
    MsgBox("Please Insert Your Text")
    Exit Sub
    End If

    If nb_071.Text.Length = 0 Then
    MsgBox("Please Insert Your Text")
    Exit Sub
    End If

    If Val(hj_071.Text) = 0 Then
    MsgBox("Please Insert Your Text")
    Exit Sub
    End If

    If Val(jb_071.Text) = 0 Then
    MsgBox("Please Insert Your Text")
    Exit Sub
    End If

    'perintah ambil data
    If kbl_071.Text <> kb_071.Text Then
    Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
    PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", kb_071.Text, 1, go)

    If PENCARI.JumlanBaris > 0 Then
    MsgBox("The data has been exist please insert new data")

    'mengosongkan text box
    kbl_071.Text = ""
    kb_071.Text = ""
    nb_071.Text = ""
    hj_071.Text = ""
    jb_071.Text = ""
    Exit Sub
    End If
    End If

    'deklarasi object command
    Dim Cm As New OleDb.OleDbCommand
    Cm = New OleDb.OleDbCommand("Update BARANG set kodebarang ='" & kb_071.Text & "', namabarang = '" & nb_071.Text & "', hargajual=" & Val(hj_071.Text) & ", jumlahbarang=" & Val(jb_071.Text) & " where kodebarang='" & kbl_071.Text & "'", go)
    go.Open()
    Cm.ExecuteNonQuery()
    go.Close()
    Cm.Dispose()

    'mengosongkan text box
    kbl_071.Text = "-"
    kb_071.Text = ""
    nb_071.Text = ""
    hj_071.Text = ""
    jb_071.Text = ""

    'mengambildata
    Latihan32A_071.ambildata()

    'menutup form
    Me.Close()

    End Sub
    End Class

    BalasHapus
  10. Public Class Latihan32A

    Dim X As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
    Dim dt1 As New DataTable

    Public Sub by()
    Dim A As New OleDb.OleDbDataAdapter
    A = New OleDb.OleDbDataAdapter("Select * From BARANG", X)
    dt1.Rows.Clear()
    A.Fill(dt1)
    A.Dispose()
    End Sub

    Private Sub Latihan32A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    by()
    dgv070.DataSource = dt1
    End Sub

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

    Latihan32B.Show()

    End Sub

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

    Latihan32C.Show()
    Latihan32C.KBrg1.Text = dgv070.CurrentRow.Cells("Kodebarang").Value
    Latihan32C.kb070.Text = dgv070.CurrentRow.Cells("Kodebarang").Value
    Latihan32C.nb070.Text = dgv070.CurrentRow.Cells("Namabarang").Value
    Latihan32C.hj070.Text = dgv070.CurrentRow.Cells("Hargajual").Value
    Latihan32C.jb070.Text = dgv070.CurrentRow.Cells("Jumlahbarang").Value
    End Sub
    End Class

    BalasHapus
  11. Public Class Latihan32B
    Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")

    Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan.Click
    If kb070.Text.Length = 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If

    If nb070.Text.Length = 0 Then
    MsgBox("Nama barang sudah ada")
    Exit Sub
    End If

    If Val(hj070.Text) = 0 Then
    MsgBox("Harga jual sudah ada")
    Exit Sub
    End If

    If Val(jb070.Text) = 0 Then
    MsgBox("Jumlah barang sudah ada")
    Exit Sub
    End If

    Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
    pencari.AturPencarianDataBase("Barang", "Kodebarang", kb070.Text, 1, A)
    If pencari.JumlanBaris > 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If

    Dim CM As New OleDb.OleDbCommand
    CM = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & kb070.Text & "', '" & nb070.Text & "', " & Val(hj070.Text) & ", " & Val(jb070.Text) & ")", A)
    A.Open()
    CM.ExecuteNonQuery()
    A.Close()
    CM.Dispose()

    kb070.Text = ""
    nb070.Text = ""
    hj070.Text = ""
    jb070.Text = ""

    Latihan32A.by()
    End Sub
    End Class

    BalasHapus
  12. Public Class Latihan32C
    Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")

    Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan.Click
    If KBrg1.Text.Length = 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If

    If kb070.Text.Length = 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If

    If nb070.Text.Length = 0 Then
    MsgBox("Nama barang sudah ada")
    Exit Sub
    End If

    If Val(hj070.Text) = 0 Then
    MsgBox("Harga jual sudah ada")
    Exit Sub
    End If

    If Val(jb070.Text) = 0 Then
    MsgBox("Jumlah barang sudah ada")
    Exit Sub
    End If

    If KBrg1.Text <> kb070.Text Then
    Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
    pencari.AturPencarianDataBase("Barang", "Kodebarang", kb070.Text, 1, A)
    If pencari.JumlanBaris > 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If
    End If

    Dim CM As New OleDb.OleDbCommand
    CM = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & kb070.Text & "', NAMABARANG= '" & nb070.Text & "', HARGAJUAL= " & Val(hj070.Text) & ", JUMLAHBARANG= " & Val(jb070.Text) & " WHERE KODEBARANG='" & KBrg1.Text & "'", A)
    A.Open()
    CM.ExecuteNonQuery()
    A.Close()
    CM.Dispose()

    KBrg1.Text = "-"
    kb070.Text = ""
    nb070.Text = ""
    hj070.Text = ""
    jb070.Text = ""

    Latihan32A.by()
    End Sub
    End Class

    BalasHapus
  13. Public Class Form32C
    Dim I 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 KB.Text.Length = 0 Then
    MsgBox("kode barang sudah ada")
    Exit Sub
    End If

    If c1.Text.Length = 0 Then
    MsgBox("kode barang sudah ada")
    Exit Sub
    End If

    If c2.Text.Length = 0 Then
    MsgBox("nama barang sudah ada")
    Exit Sub
    End If

    If Val(c3.Text) = 0 Then
    MsgBox("harga jual sudah ada")
    Exit Sub
    End If

    If Val(c4.Text) = 0 Then
    MsgBox("jumlah barang sudah ada")
    Exit Sub
    End If

    If KB.Text <> c1.Text Then
    Dim cari As New ByIskandar.CariKeDataBaseByIskandar
    cari.AturPencarianDataBase("Barang", "Kodebarang", c1.Text, 1, I)
    If cari.JumlanBaris > 0 Then
    MsgBox("kode barang sudah ada")
    Exit Sub
    End If
    End If

    Dim CI As New OleDb.OleDbCommand
    CI = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & c1.Text & "', NAMABARANG= '" & c2.Text & "', HARGAJUAL= " & Val(c3.Text) & ", JUMLAHBARANG= " & Val(c4.Text) & " WHERE KODEBARANG='" & KB.Text & "'", I)
    I.Open()
    CI.ExecuteNonQuery()
    I.Close()
    CI.Dispose()

    KB.Text = ""
    c1.Text = ""
    c2.Text = ""
    c3.Text = ""
    c4.Text = ""

    Form32A.cute()
    End Sub
    End Class

    BalasHapus
  14. Public Class Form32B
    Dim I 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 c1.Text.Length = 0 Then
    MsgBox("kode barang sudah ada")
    Exit Sub
    End If

    If c2.Text.Length = 0 Then
    MsgBox("nama barang sudah ada")
    Exit Sub
    End If

    If Val(c3.Text) = 0 Then
    MsgBox("harga jual sudah ada")
    Exit Sub
    End If

    If Val(c4.Text) = 0 Then
    MsgBox("jumlah barang sudah ada")
    Exit Sub
    End If

    Dim cari As New ByIskandar.CariKeDataBaseByIskandar
    cari.AturPencarianDataBase("Barang", "Kodebarang", c1.Text, 1, I)
    If cari.JumlanBaris > 0 Then
    MsgBox("kode barang sudah ada")
    Exit Sub
    End If

    Dim CI As New OleDb.OleDbCommand
    CI = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HAGAJUAL, JUMLAHBARANG) VALUES ('" & c1.Text & "', '" & c2.Text & "', " & Val(c3.Text) & ", " & Val(c4.Text) & ")", I)
    I.Open()
    CI.ExecuteNonQuery()
    I.Close()
    CI.Dispose()

    c1.Text = ""
    c2.Text = ""
    c3.Text = ""
    c4.Text = ""

    Form32A.cute()
    End Sub
    End Class

    BalasHapus
  15. Public Class Form32A
    Dim C As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;Data source=" & Application.StartupPath & "\DATABARANG.accdb")
    Dim cc As New DataTable
    Public Sub cute()
    Dim I As New OleDb.OleDbDataAdapter
    I = New OleDb.OleDbDataAdapter("Select * from Barang", C)
    cc.Rows.Clear()
    I.Fill(cc)
    I.Dispose()

    End Sub

    Private Sub Form32A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    cute()
    DataGridView1.DataSource = cc

    End Sub

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

    Form32B.Show()

    End Sub

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

    Form32C.Show()
    Form32C.KB.Text = DataGridView1.CurrentRow.Cells("Kodebarang").Value
    Form32C.c1.Text = DataGridView1.CurrentRow.Cells("Kodebarang").Value
    Form32C.c2.Text = DataGridView1.CurrentRow.Cells("Namabarang").Value
    Form32C.c3.Text = DataGridView1.CurrentRow.Cells("Hargabarang").Value
    Form32C.c4.Text = DataGridView1.CurrentRow.Cells("jumlahbarang").Value
    End Sub
    End Class

    BalasHapus
  16. Muhammad Nur

    Public Class Latihan032A077

    Dim n As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
    Dim dt1 As New DataTable

    Public Sub Ina()
    Dim A As New OleDb.OleDbDataAdapter
    A = New OleDb.OleDbDataAdapter("Select * From BARANG", n)
    dt1.Rows.Clear()
    A.Fill(dt1)
    A.Dispose()
    End Sub

    Private Sub Latihan032A077_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Ina()
    DGV32A.DataSource = dt1
    End Sub

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

    LATIHAN032B077.Show()

    End Sub

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

    Latihan032C077.Show()
    Latihan032C077.KBrg1077.Text = DGV32A.CurrentRow.Cells("Kodebarang").Value
    Latihan032C077.KBrg077.Text = DGV32A.CurrentRow.Cells("Kodebarang").Value
    Latihan032C077.NBrg077.Text = DGV32A.CurrentRow.Cells("Namabarang").Value
    Latihan032C077.Hjual077.Text = DGV32A.CurrentRow.Cells("Hargajual").Value
    Latihan032C077.JBrg077.Text = DGV32A.CurrentRow.Cells("Jumlahbarang").Value
    End Sub
    End Class

    BalasHapus
  17. Public Class Latihan032B077

    Dim n As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")

    Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan.Click
    If KBrg077.Text.Length = 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If

    If NBrg077.Text.Length = 0 Then
    MsgBox("Nama barang sudah ada")
    Exit Sub
    End If

    If Val(Hjual077.Text) = 0 Then
    MsgBox("Harga jual sudah ada")
    Exit Sub
    End If

    If Val(JBrg077.Text) = 0 Then
    MsgBox("Jumlah barang sudah ada")
    Exit Sub
    End If

    Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
    pencari.AturPencarianDataBase("Barang", "Kodebarang", KBrg077.Text, 1, n)
    If pencari.JumlanBaris > 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If

    Dim CM As New OleDb.OleDbCommand
    CM = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & KBrg077.Text & "', '" & NBrg077.Text & "', " & Val(Hjual077.Text) & ", " & Val(JBrg077.Text) & ")", n)
    n.Open()
    CM.ExecuteNonQuery()
    n.Close()
    CM.Dispose()

    KBrg077.Text = ""
    NBrg077.Text = ""
    Hjual077.Text = ""
    JBrg077.Text = ""

    Latihan032A077.Ina()
    End Sub
    End Class

    Public Class Latihan032C077

    Dim n As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")

    Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan.Click
    If KBrg1077.Text.Length = 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If

    If KBrg077.Text.Length = 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If

    If NBrg077.Text.Length = 0 Then
    MsgBox("Nama barang sudah ada")
    Exit Sub
    End If

    If Val(Hjual077.Text) = 0 Then
    MsgBox("Harga jual sudah ada")
    Exit Sub
    End If

    If Val(JBrg077.Text) = 0 Then
    MsgBox("Jumlah barang sudah ada")
    Exit Sub
    End If

    If KBrg1077.Text <> KBrg077.Text Then
    Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
    pencari.AturPencarianDataBase("Barang", "Kodebarang", KBrg077.Text, 1, n)
    If pencari.JumlanBaris > 0 Then
    MsgBox("Kode barang sudah ada")
    Exit Sub
    End If
    End If

    Dim CM As New OleDb.OleDbCommand
    CM = New OleDb.OleDbCommand("UPDATE BARANG SET KODEBARANG= '" & KBrg077.Text & "', NAMABARANG= '" & NBrg077.Text & "', HARGAJUAL= " & Val(Hjual077.Text) & ", JUMLAHBARANG= " & Val(JBrg077.Text) & " WHERE KODEBARANG='" & KBrg1077.Text & "'", n)
    n.Open()
    CM.ExecuteNonQuery()
    n.Close()
    CM.Dispose()

    KBrg1077.Text = "-"
    KBrg077.Text = ""
    NBrg077.Text = ""
    Hjual077.Text = ""
    JBrg077.Text = ""

    Latihan032A077.Ina()
    End Sub
    End Class

    BalasHapus
  18. Public Class latihan_32a
    Dim CONECT As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:Database Password=danangprayudha")
    Dim danang As New DataTable

    Private Sub latihan_32a_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim coba As New OleDb.OleDbDataAdapter
    coba = New OleDb.OleDbDataAdapter("select * from barang", CONECT)
    coba.Fill(danang)
    dgv.DataSource = danang
    End Sub

    Private Sub Button1069_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1069.Click
    If latihan_32c.Visible = False Then
    latihan_32c.Show()
    Else
    latihan_32c.Activate()
    End If
    latihan_32c.ToolStripStatusLabel1.Text = "kode barang lama= " & dgv.CurrentRow.Cells("KodeBarang").Value
    latihan_32c.kobar069.Text = dgv.CurrentRow.Cells("KodeBarang").Value
    latihan_32c.nabar069.Text = dgv.CurrentRow.Cells("NamaBarang").Value
    latihan_32c.harju069.Text = dgv.CurrentRow.Cells("Hargajual").Value
    latihan_32c.jubar069.Text = dgv.CurrentRow.Cells("jumlahbarang").Value

    End Sub
    End Class
    Public Class latihan_32b
    Dim CONECT As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:Database Password=danangprayudha")

    Private Sub Button1069_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1069.Click
    If Val(kobar069.Text) = 0 Then
    MsgBox("kode barang belum terisi")
    Exit Sub
    End If

    If nabar069.Text.Length = 0 Then
    MsgBox("nama barang belum terisi")
    Exit Sub
    End If

    If Val(harju069.Text) = 0 Then
    MsgBox("harga jual belum diisi")
    Exit Sub
    End If

    If Val(jubar069.Text) = 0 Then
    MsgBox("jumlah barang belum diisi")
    Exit Sub
    End If
    Dim danang As New OleDb.OleDbCommand
    danang = New OleDb.OleDbCommand("PsTambahBarang", CONECT)
    danang.CommandType = CommandType.StoredProcedure
    danang.Parameters.Add(New OleDb.OleDbParameter("pKodeBarang", kobar069.Text))
    danang.Parameters.Add(New OleDb.OleDbParameter("pNamaBarang", nabar069.Text))
    danang.Parameters.Add(New OleDb.OleDbParameter("pPersawal", Val(harju069.Text)))
    danang.Parameters.Add(New OleDb.OleDbParameter("pHargajual", Val(jubar069.Text)))
    CONECT.Open()
    danang.ExecuteNonQuery()
    CONECT.Close()
    danang.Dispose()

    kobar069.Text = ""
    nabar069.Text = ""
    harju069.Text = ""
    jubar069.Text = ""

    End Sub

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

    End Sub
    End Class

    BalasHapus
  19. Public Class latihan_32c
    Dim CONECT As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:Database Password=danangprayudha")

    Private Sub Button1069_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1069.Click
    If Val(kobar069.Text) = 0 Then
    MsgBox("kode barang belum terisi")
    Exit Sub
    End If

    If nabar069.Text.Length = 0 Then
    MsgBox("nama barang belum terisi")
    Exit Sub
    End If

    If Val(harju069.Text) = 0 Then
    MsgBox("harga jual belum diisi")
    Exit Sub
    End If

    If Val(jubar069.Text) = 0 Then
    MsgBox("jumlah barang belum diisi")
    Exit Sub
    End If
    Dim com As New OleDb.OleDbCommand
    com = New OleDb.OleDbCommand("UPDATE BARANG SET kodebarang = '" & kobar069.Text & "', namabarang = '" & nabar069.Text & "', hargajual = " & Val(harju069.Text) & ", jumlahbarang = " & Val(jubar069.Text) & " where kodebarang ='" & ToolStripStatusLabel1.Text & "'", CONECT)

    CONECT.Open()
    com.ExecuteNonQuery()
    CONECT.Close()
    com.Dispose()

    kobar069.Text = ""
    nabar069.Text = ""
    harju069.Text = ""
    jubar069.Text = ""

    End Sub
    End Class

    BalasHapus