tampilan awal program listview
tampilan listview sebelum di input nilai
tampilan setelah hasil listview di simpan
Public Class Form1
Sub BuatTable()
lv.Columns.Add("No pembelian", 80, HorizontalAlignment.Center)
lv.Columns.Add("Kode Barang", 80, HorizontalAlignment.Left)
lv.Columns.Add("Nama Barang", 80, HorizontalAlignment.Left)
lv.Columns.Add("Merk", 80, HorizontalAlignment.Left)
lv.Columns.Add("Harga", 80, HorizontalAlignment.Left)
lv.Columns.Add("Jumlah Beli", 80, HorizontalAlignment.Left)
lv.Columns.Add("Total Harga", 80, HorizontalAlignment.Left)
lv.View = View.Details
lv.GridLines = True
lv.FullRowSelect = True
End Sub
Sub IsiTable()
Dim Lst As New ListViewItem
Lst.Text = NoPembelian.Text
Lst.SubItems.Add(KodeBarang.Text)
Lst.SubItems.Add(NamaBarang.Text)
Lst.SubItems.Add(Merk.Text)
Lst.SubItems.Add(Harga.Text)
Lst.SubItems.Add(JumlahBeli.Text)
Lst.SubItems.Add(TotalHarga.Text)
lv.Items.Add(Lst)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
KodeBarang.Items.Add("TS001")
KodeBarang.Items.Add("TS002")
KodeBarang.Items.Add("VG001")
KodeBarang.Items.Add("VG002")
BuatTable()
End Sub
Private Sub KodeBarang_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KodeBarang.SelectedIndexChanged
Dim x As String
x = Microsoft.VisualBasic.Left(KodeBarang.Text, 2)
Select Case x
Case "TS" : Merk.Text = "Toshiba"
Case "VG" : Merk.Text = "V-Gen"
End Select
x = Microsoft.VisualBasic.Right(KodeBarang.Text, 3)
Select Case x
Case "001" : NamaBarang.Text = "Flashdisk 4Gb"
Case "002" : NamaBarang.Text = "Flashdisk 2Gb"
End Select
x = Microsoft.VisualBasic.Right(KodeBarang.Text, 5)
Select Case x
Case "TS001" : Harga.Text = "105000"
Case "TS002" : Harga.Text = "75000"
Case "VG001" : Harga.Text = "90000"
Case "VG002" : Harga.Text = "60000"
End Select
End Sub
Private Sub BtnProses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnProses.Click
TotalHarga.Text = Harga.Text * JumlahBeli.Text
End Sub
Private Sub Btnsimpankelistview_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnsimpankelistview.Click
IsiTable()
NoPembelian.Text = ""
KodeBarang.Text = ""
NamaBarang.Text = ""
Merk.Text = ""
JumlahBeli.Text = ""
TotalHarga.Text = ""
End Sub
End Class
Tidak ada komentar:
Posting Komentar