Tampilan Desain Latihan Listview Perhitungan Penjualan Barang

Sabtu, 07 Desember 20130 komentar


Tampilan Desain Latihan Listview Perhitungan Penjualan Barang


Di bawah ini adalah listing program dari Latihan Listview Perhitungan Penjualan Barang :

Public Class Form1
    Sub kode()
        kodebarang.Items.Add("TS001")
        kodebarang.Items.Add("TS002")
        kodebarang.Items.Add("VG001")
        kodebarang.Items.Add("VG002")
    End Sub
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Call kode()
        Call rancang_tabel()
    End Sub

    Private Sub kodebarang_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kodebarang.SelectedIndexChanged
        Dim a As String
        a = Microsoft.VisualBasic.Left(kodebarang.Text, 2)

        If a = "TS" Then
            merek.Text = "TOSHIBA"
        Else
            merek.Text = "V-Gen"
        End If
        a = Microsoft.VisualBasic.Right(kodebarang.Text, 3)
        If a = "001" Then
            namabarang.Text = "Flashdisk 4 GB"
        Else
            namabarang.Text = "Flashdisk 2 GB"
        End If
        If kodebarang.Text = "TS001" Then
            harga.Text = 105000
        ElseIf kodebarang.Text = "TS002" Then
            harga.Text = 75000
        ElseIf kodebarang.Text = "VG001" Then
            harga.Text = 90000
        Else
            harga.Text = 60000

        End If
    End Sub
    Private Sub jumlahbeli_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles jumlahbeli.KeyPress
        Dim b As Integer = Asc(e.KeyChar)
        If b = 13 Then
            totalharga.Text = harga.Text * jumlahbeli.Text
        End If
    End Sub
    Sub proses()

    End Sub

    Private Sub Buttonbersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonbersih.Click
        Call bersih()
    End Sub

    Sub bersih()
        nopembelian.Text = ""
        kodebarang.Text = ""
        namabarang.Text = ""
        merek.Text = ""
        harga.Text = ""
        jumlahbeli.Text = ""
        totalharga.Text = ""
    End Sub

    Sub rancang_tabel()
        LV.Columns.Add("No. Pembelian", 50, HorizontalAlignment.Left)
        LV.Columns.Add("Kode Barang", 50, HorizontalAlignment.Left)
        LV.Columns.Add("Nama Barang", 100, HorizontalAlignment.Left)
        LV.Columns.Add("Merek", 50, HorizontalAlignment.Left)
        LV.Columns.Add("Harga", 50, HorizontalAlignment.Left)
        LV.Columns.Add("Jumlah Beli", 50, HorizontalAlignment.Left)
        LV.Columns.Add("Total Harga", 100, HorizontalAlignment.Left)
        LV.GridLines = True
        LV.FullRowSelect = True
        LV.View = View.Details
    End Sub
    Sub isi_tabel()
        Dim x As New ListViewItem
        x.Text = nopembelian.Text
        x.SubItems.Add(kodebarang.Text)
        x.SubItems.Add(namabarang.Text)
        x.SubItems.Add(merek.Text)
        x.SubItems.Add(harga.Text)
        x.SubItems.Add(jumlahbeli.Text)
        x.SubItems.Add(totalharga.Text)
        LV.Items.Add(x)
    End Sub

    Private Sub Buttonsimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonsimpan.Click
        Call isi_tabel()
        Call bersih()
    End Sub

    Private Sub Buttonkeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonkeluar.Click
        Dim a As String
        a = MsgBox("Apakah anda yakin ingin kelluar?", MsgBoxStyle.YesNo)
        If a = vbYes Then
            Me.Close()
        End If
    End Sub

    Private Sub Buttonhapussemua_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonhapussemua.Click
        LV.Items.Clear()
    End Sub

    Private Sub Buttonhapusdata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonhapusdata.Click
        LV.Items.Remove(LV.SelectedItems(0))
    End Sub
End Class


Di bawah ini merupakan hasil tampilan desain dan listing program dari Latihan Listview Perhitungan Penjualan Barang 

 


Share this article :

Posting Komentar

 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. A & L FOREVER - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger