Penjualan Barang Menggunakan VB NET




Ass, langsung saja disini saya akan memberi tutorial pembuatan program penjualan barang di VB NET, langsung saja ikutin list koding di bawah ini:
 
Public Class Form1
   ub buattabel()
        With LV
            Columns.Add("Kode", 60, HorizontalAlignment.Center)
            Columns.Add("Nama", 80, HorizontalAlignment.Left)
            Columns.Add("Harga", 50, HorizontalAlignment.Right)
            Columns.Add("Jumlah", 60, HorizontalAlignment.Right)
            Columns.Add("Total", 60, HorizontalAlignment.Right)
            View = View.Details
            GridLines = True
            FullRowSelect = True
        End With
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        For i = 1 To 3
            Jumlah.Items.Add(i)
        Next
        For i = 1 To 9
            Kode.Items.Add("P00" & i)
        Next
        Call buattabel()
    End Sub


     Private Sub kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Kode.SelectedIndexChanged
        Select Case Kode.Text
            Case "P001"
                Nama.Text = "TELEVISI LCD"
                Harga.Text = 2000000
            Case "P002"
                Nama.Text = "DVD SONY"
                Harga.Text = 200000

        End Select
        Try
            Gambar.Image = Image.FromFile("E:\Gambar\" & "P001.JPG")

        Catch ex As Exception
            Gambar.Image = Nothing

        End Try
    End Sub


 Private Sub jumlah_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Jumlah.SelectedIndexChanged
        Total.Text = Harga.Text * Jumlah.Text
    End Sub

    Private Sub BtnBatal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnBatal.Click
        Kode.Text = ""
        Nama.Text = ""
        Harga.Text = ""
        Total.Text = ""
        Jumlah.Text = ""
    End Sub

    Private Sub BtnProses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnProses.Click
        Dim lst As New ListViewItem
        lst.Text = Kode.Text
        lst.SubItems.Add(Nama.Text)
        lst.SubItems.Add(Harga.Text)
        lst.SubItems.Add(Jumlah.Text)
        lst.SubItems.Add(Total.Text)
        LV.Items.Add(lst)
        Call BtnBatal_Click(sender, e)

    End Sub

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

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

    Private Sub BtnKeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnKeluar.Click
        Me.Close()
    End Sub
End Class


Selamat Mencoba...
Previous
Next Post »