Terimakasih Atas Kunjungan Anda Sytalo Poenya: PROG SEDERHANA JUAL BELI BARANG MENGGUNAKAN LISTBOX

Selasa, 29 November 2011

PROG SEDERHANA JUAL BELI BARANG MENGGUNAKAN LISTBOX


PROG JUAL BELI BARANG MENGGUNAKAN LISTBOX

Public Class Form1

    Sub ISITABEL()
        Dim LST As New ListViewItem
        LST.Text = NAMA.Text
        LST.SubItems.Add(ComboBox1.Text)
        LST.SubItems.Add(ComboBox2.Text)
        LST.SubItems.Add(HARGA.Text)
        LST.SubItems.Add(JUMLAH.Text)
        LST.SubItems.Add(TOTAL.Text)
        LV.Items.Add(LST)

    End Sub

    Sub BUATTABEL()
        LV.Columns.Add("NAMA PEMBELI", 100, HorizontalAlignment.Left)
        LV.Columns.Add("MERK", 100, HorizontalAlignment.Left)
        LV.Columns.Add("UKURAN", 100, HorizontalAlignment.Left)
        LV.Columns.Add("HARGA", 100, HorizontalAlignment.Left)
        LV.Columns.Add("JLH BELI", 100, HorizontalAlignment.Left)
        LV.Columns.Add("TOTAL", 100, HorizontalAlignment.Left)
        LV.GridLines = True
        LV.FullRowSelect = True
        LV.View = View.Details
    End Sub


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ComboBox1.Items.Add("LG")
        ComboBox1.Items.Add("TOSHIBA")
        ComboBox1.Items.Add("SAMSUNG")
        ComboBox2.Items.Add("21 INCHI")
        ComboBox2.Items.Add("32 INCHI")
        ComboBox2.Items.Add("40 INCHI")
        BUATTABEL()
    End Sub

    Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
        Select Case ComboBox1.Text
            Case "LG"
                If ComboBox2.Text = "21 INCHI" Then
                    HARGA.Text = 1500000
                ElseIf ComboBox2.Text = "32 INCHI" Then
                    HARGA.Text = 3200000
                Else
                    HARGA.Text = 4100000
                End If
            Case "TOSHIBA"
                If ComboBox2.Text = "21 INCHI" Then
                    HARGA.Text = 1700000
                ElseIf ComboBox2.Text = "32 INCHI" Then
                    HARGA.Text = 3300000
                Else
                    HARGA.Text = 4300000
                End If

            Case "SAMSUNG"
                If ComboBox2.Text = "21 INCHI" Then
                    HARGA.Text = 1450000
                ElseIf ComboBox2.Text = "32 INCHI" Then
                    HARGA.Text = 3200000
                Else
                    HARGA.Text = 4050000
                End If
        End Select

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.Close()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        NAMA.Text = ""
        ComboBox1.Text = ""
        ComboBox2.Text = ""
        HARGA.Text = ""
        JUMLAH.Text = ""
        TOTAL.Text = ""
    End Sub

    Private Sub JUMLAH_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles JUMLAH.KeyPress
        Dim TOMBOL As Integer = Asc(e.KeyChar)

        If TOMBOL = 13 Then
            TOTAL.Text = Val(HARGA.Text) * Val(JUMLAH.Text)
            ISITABEL()
        End If

    End Sub


    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        ComboBox2_SelectedIndexChanged(sender, e)
    End Sub
End Class

Tidak ada komentar:

Posting Komentar