FOTO SAMPUL

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque sed felis. Aliquam sit amet felis. Mauris semper, velit semper laoreet dictum, quam diam dictum urna, nec placerat elit nisl in quam. Etiam augue pede, molestie eget, ...

Category name clash

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque sed felis. Aliquam sit amet felis. Mauris semper, velit semper laoreet dictum, quam diam dictum urna, nec placerat elit nisl in quam. Etiam augue pede, molestie eget, rhoncus at, convallis ut, eros. Aliquam pharetra. Nulla in tellus eget odio sagittis blandit. ...

Test with enclosures

Here's an mp3 file that was uploaded as an attachment: Juan Manuel Fangio by Yue And here's a link to an external mp3 file: Acclimate by General Fuzz Both are CC licensed. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque sed felis. Aliquam sit amet felis. Mauris semper, velit semper laoreet dictum, ...

Block quotes

Some block quote tests: Here's a one line quote. This part isn't quoted. Here's a much longer quote: Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In dapibus. In pretium pede. Donec molestie facilisis ante. Ut a turpis ut ipsum pellentesque tincidunt. Morbi blandit sapien in mauris. Nulla lectus lorem, varius aliquet, ...

Contributor post, approved

I'm just a lowly contributor. My posts must be approved by the editor.Mauris semper, velit semper laoreet dictum, quam diam dictum urna, nec placerat elit nisl in quam. Etiam augue pede, molestie eget, rhoncus at, convallis ut, eros. Aliquam pharetra. Nulla in tellus eget odio sagittis blandit. Maecenas at ...

Posted by Unknown - - 0 komentar


DESKRIPSI LATIHAN

Pada latihan ini ada 3 form yang akan dibuat, yaitu Latihan_32a_46110021, Latihan_32b_46110021, dan Latihan_32c_46110021
I.          Latihan_32a_46110021
Pada form ini terdapat 3 jenis object, yaitu label, datagridview, dan button
A.       Object Label.
Pada form ini, terdapat 1 label yang bertuliskan “Daftar Barang”
B.       Object Datagridview
Pada form ini terdapat 1 datagrid view yang akan memunculkan datatable yang berasal dari data base.
C.       Object Button
Pada form ini, terdapat 2 button, yaitu Tambah dan Edit. Tambah berfungsi untuk memunculkan Latihan_32b_46110021, sedangkan Edit berfungsi untuk memunculkan form Latihan_32c_46110021

II.          Latihan_32b_46110021
Pada form ini terdapat 3 jenis object, yaitu label, textbox, dan button
A.       Object Label.
Pada form ini, terdapat 4 label yaitu Kode barang, Nama Barang, Harga jual, dan Jumlah barang
B.       Object Textbox
Terdapat 4 text box yang berfungsi sebagai tempat untuk menginput data
C.       Object Button
Terdapat 1 button yaitu simpan yang berfungsi untuk menyimpan data yang telah dimasukkan ke dalam text box.

III.          Latihan_32c_46110021
Pada form ini terdapat 4 jenis object, yaitu label, Textbox satusstrip dan button
A.       Object Label.
Pada form ini, terdapat 4 label yaitu Kode barang, Nama Barang, Harga jual, dan Jumlah barang
B.       Object TextBox
Terdapat 4 text box yang berfungsi sebagai tempat untuk menginput data
C.       Object Statusstrip
Terdapat 2 status strip yaitu kode barang dan -
D.       Object Button
Terdapat 1 button yaitu simpan yang berfungsi untuk menyimpan data yang telah dimasukkan ke dalam text box

CARA MEMBUAT FORM

A.      Pertama buka project yang anda buat, lalu pada menu bar pilih add windows form…

B.       Ubah nama form sesuai dengan yang diinginkan lalu tekan tombol ADD

C.       Buatlah desain form seperti dengan gambar dibawah ini. Sesuaikan object yang ada dalam form dengan deskripsinya agar tidak salah memilih object.

D.      Ubah nama setiap object kecuali bject label. Dengan cara mengganti “Name” di Properti bar.

E.       Lakukan kembali point A dan B untuk membuat form Latihan_32b_46110021. Lalu lakukan langkah yang ada dalam point C tetapi desainnya seperti dibawah ini. Lakukan kembali point D.

F.     Untuk membuat form Latihan_32c_46110021, lakukan hal yang sama dengan point E, namun pada Point C desainnya adalah seperti dibawah ini.

G.   Setelah itu masukkan code pada form Latihan_32b_46110021 dan Latihan_32c_46110021 dengan cara klik kanan pada masing2 form dan masukkan kode dibawah ini.
a.         Code untuk Latihan_32b_46110021
        Public Class Latihan_32b_46110021
    Dim Jalan 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 Simpan_46110021.Click
        
        If Kode_46110021.Text.Length = 0 Then
            MsgBox("Plase Insert Your Text")
            Exit Sub
        End If

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

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

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

        
        Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
        PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", Kode_46110021.Text, 1, Jalan)

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

            
            Kode_46110021.Text = " "
            Nama_46110021.Text = " "
            Harga_46110021.Text = " "
            Jumlah_46110021.Text = " "
            Exit Sub
        End If

       
        Dim Cm As New OleDb.OleDbCommand
        Cm = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & Kode_46110021.Text & "','" & Nama_46110021.Text & "', " & Val(Harga_46110021.Text) & "," & Val(Jumlah_46110021.Text) & ")", Jalan)
        Jalan.Open()
        Cm.ExecuteNonQuery()
        Jalan.Close()
        Cm.Dispose()

        
        Kode_46110021.Text = " "
        Nama_46110021.Text = " "
        Harga_46110021.Text = " "
        Jumlah_46110021.Text = " "

       
        Latihan_32a_46110021.ambildata()

        
        Me.Close()

    End Sub

End Class


b.         Code untuk latihan_32c_46110021
               Public Class Latihan_32c_46110021

    Dim Jalan 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 Simpan_46110021.Click
       
        If Kode_46110021.Text.Length = 0 Then
            MsgBox("Plase Insert Your Text")
            Exit Sub
        End If

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

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

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

        If Ganti_46110021.Text <> Kode_46110021.Text Then
            Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
            PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", Kode_46110021.Text, 1, Jalan)

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

                
                Kode_46110021.Text = " "
                Nama_46110021.Text = " "
                Harga_46110021.Text = " "
                Jumlah_46110021.Text = " "
                Exit Sub
            End If
        End If

    
        Dim Cm As New OleDb.OleDbCommand
        Cm = New OleDb.OleDbCommand("Update BARANG set kodebarang ='" & Kode_46110021.Text & "', namabarang = '" & Nama_46110021.Text & "', hargajual=" & Val(Harga_46110021.Text) & ", jumlahbarang=" & Val(Jumlah_46110021.Text) & " where kodebarang='" & Ganti_46110021.Text & "'", Jalan)
        Jalan.Open()
        Cm.ExecuteNonQuery()
        Jalan.Close()
        Cm.Dispose()

    
        Ganti_46110021.Text = "-"
        Kode_46110021.Text = " "
        Nama_46110021.Text = " "
        Harga_46110021.Text = " "
        Jumlah_46110021.Text = " "

      
        Latihan_32a_46110021.ambildata()

        
        Me.Close()
    End Sub

End Class

H.      Setelah itu, masukkan kode untuk Latihan_32a_46110021
 Public Class Latihan_32a_46110021

    Dim Jalan As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source =" & Application.StartupPath & "\DataBarang.ACCDB")
    Dim ambil As New DataTable

    Public Sub ambildata()
        
        Dim data As New OleDb.OleDbDataAdapter

        
        data = New OleDb.OleDbDataAdapter("SELECT* FROM barang", Jalan)

       
        ambil.Rows.Clear()

        
        data.Fill(ambil)
        data.Dispose()

    End Sub

    Private Sub Latihan32a_083_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ambildata()
        DataGridView1_46110021.DataSource = ambil
    End Sub
    Private Sub tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tambah_46110021.Click
      
        If Latihan_32b_46110021.Visible = False Then
            Latihan_32b_46110021.Show()
        Else
            Latihan_32b_46110021.Activate()
        End If
    End Sub
    Private Sub EDit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Edit_46110021.Click
      
        If Latihan_32c_46110021.Visible = False Then
            Latihan_32c_46110021.Show()
        Else
            Latihan_32c_46110021.Activate()
        End If

      
        Latihan_32c_46110021.Ganti_46110021.Text = DataGridView1_46110021.CurrentRow.Cells("kodebarang").Value
        Latihan_32c_46110021.Kode_46110021.Text = DataGridView1_46110021.CurrentRow.Cells("kodebarang").Value
        Latihan_32c_46110021.Nama_46110021.Text = DataGridView1_46110021.CurrentRow.Cells("namabarang").Value
        Latihan_32c_46110021.Harga_46110021.Text = DataGridView1_46110021.CurrentRow.Cells("hargajual").Value
        Latihan_32c_46110021.Jumlah_46110021.Text = DataGridView1_46110021.CurrentRow.Cells("JumlahBarang").Value
    End Sub


End Class

SCRIPT UNIK
TIDAK ADA SCRIPT UNIK


LANGKAH UNTUK MENJALANKAN FORM
Untuk memudahkan pakailah navigator
A.  Pilih tombol start debugging lalu pilih form Latihan_32_46110021, maka jendela Latihan_32a_46110021 akan muncul
B.       Jika anda ingin menambahkan data maka pilih button Tambah yang ada pada Latihan_32a_46110021, maka jendela Latihan_32b_46110021 akan muncul. Tetapi jika ingin mengedit data makan pilih button edit yang ada pada Latihan_32a_46110021, maka jendela Latihan_32c_46110021 akan muncul\
C. Isi text box yang ada pada form tersebutm, lalu tekan button simpan baik anda memilih  Latihan_32b_46110021 maupun Latihan_32c_46110021

Leave a Reply