Minggu, 02 Juni 2013

Yuk! Belajar Konsep Pemrograman Di Mesran.Blogspot.Com



Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        kode_barang.Items.Add("TS001")
        kode_barang.Items.Add("TS002")
        kode_barang.Items.Add("VG001")
        kode_barang.Items.Add("VG002")
        BUATTABEL()
    End Sub
    Sub bunga(ByVal t As Form)
       
    End Sub


    Private Sub kode_barang_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kode_barang.SelectedIndexChanged
        Select Case kode_barang.Text
            Case "TS001"
                nama_barang.Text = "thosiba"
                mer_k.Text = "flasdisk 4GB"
                har_ga.Text = "105000"
            Case "TS002"
                nama_barang.Text = "thosiba"
                mer_k.Text = "flasdisk 2GB"
                har_ga.Text = "75000"
            Case "VG001"
                nama_barang.Text = "thosiba"
                mer_k.Text = "flasdisk 4GB"
                har_ga.Text = "90000"
            Case "VG002"
                nama_barang.Text = "thosiba"
                mer_k.Text = "FLASDISK 2GB"
                har_ga.Text = "60000"

        End Select

    End Sub


    Private Sub simpan_kelis_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_kelis.Click
        MsgBox("APAKAH ANDA YAKIN INGIN MENYIMPAN?", MsgBoxStyle.Question + MsgBoxStyle.YesNo)
        ISITABEL()
        bunga(Me)


    End Sub
    Sub BUATTABEL()
        LV.Columns.Add("No", 40, HorizontalAlignment.Center)
        LV.Columns.Add("Kode", 180, HorizontalAlignment.Center)
        LV.Columns.Add("merek", 80, HorizontalAlignment.Left)
        LV.Columns.Add("nama barang", 180, HorizontalAlignment.Center)
        LV.Columns.Add("total harga", 80, HorizontalAlignment.Left)
        LV.Columns.Add("harga", 180, HorizontalAlignment.Center)
        LV.Columns.Add("jumlah beli", 80, HorizontalAlignment.Left)
        LV.View = View.Details
        LV.GridLines = True
        LV.FullRowSelect = True
    End Sub

    Sub ISITABEL()
        Dim LST As New ListViewItem
        LST.SubItems.Add(kode_barang.Text)
        LST.SubItems.Add(mer_k.Text)
        LST.SubItems.Add(nama_barang.Text)
        LST.SubItems.Add(total_harga.Text)
        LST.SubItems.Add(har_ga.Text)
        LST.SubItems.Add(jumlah_beli.Text)
        LV.Items.Add(LST)


    End Sub


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        total_harga.Text = har_ga.Text * jumlah_beli.Text
    End Sub

    Private Sub kelua_r_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kelua_r.Click
        If MsgBox("APAKAH ANDA YAKIN INGIN KELUAR?", MsgBoxStyle.Question + MsgBoxStyle.YesNo) Then
            Me.Close()
        End If
    End Sub


    Private Sub bers_ih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bers_ih.Click
        kode_barang.Text = ""
        nama_barang.Text = ""
        mer_k.Text = ""
        har_ga.Text = ""
        jumlah_beli.Text = ""
        total_harga.Text = ""

    End Sub

    Private Sub hapus_semua_data_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus_semua_data.Click
        MsgBox("APAKAH ANDA YAKIN INGIN MENGHAPUS?", MsgBoxStyle.Question + MsgBoxStyle.YesNo)
        LV.Items.Clear()
    End Sub


End Class


Tidak ada komentar:

Posting Komentar