Latihan Listview Perhitungan Penjualan Barang
Berikut Jawaban Program :
Public Class
Form1
Sub
buattable()
lv.Columns.Add("No Pembelian", 80,
HorizontalAlignment.Center)
lv.Columns.Add("kode barang", 80,
HorizontalAlignment.Center)
lv.Columns.Add("Nama barang", 120,
HorizontalAlignment.Center)
lv.Columns.Add("merk", 80, HorizontalAlignment.Center)
lv.Columns.Add("total harga", 120,
HorizontalAlignment.Center)
lv.Columns.Add("Jumlah beli", 120,
HorizontalAlignment.Center)
lv.Columns.Add("harga", 120,
HorizontalAlignment.Center)
lv.View =
View.Details
lv.GridLines = True
lv.FullRowSelect = True
End Sub
Sub isitable()
Dim isi As New ListViewItem
isi.Text =
no.Text
isi.SubItems.Add(Kbarang.Text)
isi.SubItems.Add(Namabarang.Text)
isi.SubItems.Add(Merk.Text)
isi.SubItems.Add(Tharga.Text)
isi.SubItems.Add(Jbeli.Text)
isi.SubItems.Add(Harga.Text)
lv.Items.Add(isi)
End Sub
Private Sub
Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
Namabarang.Text
= ""
Merk.Text = ""
Kbarang.Items.Add("TS001")
Kbarang.Items.Add("TS002")
Kbarang.Items.Add("VG001")
Kbarang.Items.Add("VG002")
Call buattable()
For i = 12 To 48 Step -1
Next
End Sub
Private Sub
Kbarang_SelectedIndexChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Kbarang.SelectedIndexChanged
If Kbarang.Text = "
TS001" Then
Namabarang.Text = "Flashdisk
4GB"
Merk.Text =
"Toshiba"
ElseIf Kbarang.Text = "TS002"
Then
Namabarang.Text = "Flashdisk 2GB"
Merk.Text =
"Toshiba"
ElseIf Kbarang.Text = "VG001"
Then
Namabarang.Text
= "Flashdisk 4GB"
Merk.Text =
"V-Gen"
ElseIf Kbarang.Text = "VG002"
Then
Namabarang.Text = "Flashdisk 2GB"
Merk.Text =
"V-Gen"
Else
Namabarang.Text = "Flashdisk 4GB"
Merk.Text =
"Toshiba"
End If
End Sub
Private Sub
Btnsimpankelistview_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Btnsimpankelistview.Click
Call isitable()
no.Text = ""
Kbarang.Text = ""
Namabarang.Text = ""
Merk.Text = ""
Harga.Text = ""
Jbeli.Text = ""
Tharga.Text = ""
End Sub
Private Sub
Btnhapussemuadata_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Btnhapussemuadata.Click
no.Text = ""
Kbarang.Text = ""
Namabarang.Text
= ""
Merk.Text = ""
Tharga.Text = ""
Harga.Text = ""
Jbeli.Text = ""
Tharga.Text = ""
End Sub
Private Sub
Btnkeluar_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Btnkeluar.Click
Me.Close()
End Sub
Private Sub
Btnhapusdatayangdisimpan_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
Btnhapusdatayangdisimpan.Click
lv.Items.Remove(lv.SelectedItems(0))
End Sub
Private Sub
btnproses_Click_1(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles
btnproses.Click
Tharga.Text =
Val(Harga.Text) * Val(Jbeli.Text)
End Sub
End Class
hasil tampilan program penjualan barang
Demikilahlah postingan saya Nama : (APERIUS GIAWA) NPM : (13110160)
Selamat Belajar Pemrograman VB NET