Jumat, 04 November 2011

Latihan 31 Apkom 4 D3 C

9 komentar:

  1. FITRAH ADITYA HANAPI

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

    End Sub

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

    Latihan031B084.Show()
    Latihan031B084.kb1_084.Text = dgv_084.CurrentRow.Cells("Kodebarang").Value
    Latihan031B084.kb_084.Text = dgv_084.CurrentRow.Cells("Kodebarang").Value
    Latihan031B084.nb_084.Text = dgv_084.CurrentRow.Cells("Namabarang").Value
    Latihan031B084.hj_084.Text = dgv_084.CurrentRow.Cells("Hargajual").Value
    Latihan031B084.jb_084.Text = dgv_084.CurrentRow.Cells("Jumlahbarang").Value
    End Sub
    End Class


    Public Class Latihan031B084
    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 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 = ""

    Latihan031A084.Deriel()
    End Sub
    End Class

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

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

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

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

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

    Public Class Form31B
    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 = ""

    Form31A.PUTRA()
    End Sub
    End Class

    BalasHapus
  3. feby winriani syam

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

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

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

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

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

    End Class


    Public Class Form31B
    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 = ""

    Form31A.feby()
    End Sub

    End Class

    BalasHapus
  4. Public Class Latihan31B_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 Trio_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
    Trio_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='" & Trio_071.Text & "'", go)
    go.Open()
    Cm.ExecuteNonQuery()
    go.Close()
    Cm.Dispose()

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

    'mengambildata
    Latihan31A_071.ambildata()

    'menutup form
    Me.Close()
    End Sub
    End Class

    BalasHapus
  5. Public Class Form31B
    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 = ""

    Form31A.parubak()

    End Sub
    End Class

    BalasHapus
  6. Muhammad Nur

    Public Class Latihan031A077

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

    Public Sub NN()
    Dim X As New OleDb.OleDbDataAdapter
    X = New OleDb.OleDbDataAdapter("Select * From BARANG", n)
    datatabel1.Rows.Clear()
    X.Fill(datatabel1)
    X.Dispose()
    End Sub

    Private Sub Latihan31A017_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    NN()
    DGV31A.DataSource = datatabel1
    End Sub

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

    Latihan031B077.Show()
    Latihan031B077.KBrg1077.Text = DGV31A.CurrentRow.Cells("Kodebarang").Value
    Latihan031B077.KBrg077.Text = DGV31A.CurrentRow.Cells("Kodebarang").Value
    Latihan031B077.NBrg077.Text = DGV31A.CurrentRow.Cells("Namabarang").Value
    Latihan031B077.HJual077.Text = DGV31A.CurrentRow.Cells("Hargajual").Value
    Latihan031B077.JBrg077.Text = DGV31A.CurrentRow.Cells("Jumlahbarang").Value
    End Sub

    End Class

    Public Class Latihan031B077

    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 = ""

    Latihan031A077.NN()
    End Sub

    End Class

    BalasHapus
  7. Public Class latihan_31a
    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_31a_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_31b.Visible = False Then
    latihan_31b.Show()
    Else
    latihan_31b.Activate()
    End If
    latihan_31b.kobar069.Text = dgv.CurrentRow.Cells("KodeBarang").Value
    latihan_31b.ToolStripStatusLabel1.Text = "kode barang lama = " & dgv.CurrentRow.Cells("KodeBarang").Value
    latihan_31b.nabar069.Text = dgv.CurrentRow.Cells("NamaBarang").Value
    latihan_31b.harju069.Text = dgv.CurrentRow.Cells("Hargajual").Value
    latihan_31b.jubar069.Text = dgv.CurrentRow.Cells("jumlahbarang").Value

    End Sub
    End Class

    Public Class latihan_31b
    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 = ""
    jubar069.Text = ""
    harju069.Text = ""

    End Sub
    End Class

    BalasHapus
  8. Komentar ini telah dihapus oleh pengarang.

    BalasHapus
  9. http://gunawanmustari.blogspot.com/2011/12/latihan-31a.html

    BalasHapus