latihan listview perhitungan penjualan barang
berikut jawaban program:
tampilan saat dijalankan
tampilan saat dicoba, dan disimpan ke listview
Demikilahlah postingan saya Nama : Rahmat Hidayat NPM : 1111370
Selamat Pemrograman VB NET
berikut jawaban program:
Tampilan Desain awal
Public Class Form2
Sub
buattabel()
lv.Columns.Add("No
Pembelian", 80, HorizontalAlignment.Center)
lv.Columns.Add("Kode
Barang", 180, HorizontalAlignment.Center)
lv.Columns.Add("Nama
Barang", 180, HorizontalAlignment.Center)
lv.Columns.Add("Merk",
80, HorizontalAlignment.Center)
lv.Columns.Add("Harga",
80, HorizontalAlignment.Center)
lv.Columns.Add("Jumlah
Beli", 80, HorizontalAlignment.Center)
lv.Columns.Add("Total
Harga", 80, HorizontalAlignment.Center)
lv.View = View.Details
lv.GridLines = True
lv.FullRowSelect = True
End Sub
Sub
isitabel()
Dim lst
As New
ListViewItem
lst.Text = kode.Text
lst.SubItems.Add(no.Text)
lst.SubItems.Add(nama.Text)
lst.SubItems.Add(merk.Text)
lst.SubItems.Add(harga.Text)
lst.SubItems.Add(jlh.Text)
lst.SubItems.Add(total.Text)
lv.Items.Add(lst)
End Sub
Private Sub kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles
kode.SelectedIndexChanged
Dim x As String
x =
Microsoft.VisualBasic.Left(kode.Text, 2)
Select Case x
Case
"TS" : merk.Text = "Toshiba"
Case
"VG" : merk.Text = "V-Gen"
End Select
Dim y As String
y =
Microsoft.VisualBasic.Right(kode.Text, 3)
Select Case y
Case
"001" : nama.Text = "flashdisk 4 GB"
Case
"002" : nama.Text = "flashdisk 2 GB"
End Select
If x = "TS" And
y = "001" Then
harga.Text = "105000"
ElseIf
x = "TS" And
y = "002" Then
harga.Text = "75000"
ElseIf
x = "VG" And
y = "001" Then
harga.Text = "90000"
ElseIf
x = "VG" And
y = "002" Then
harga.Text = "60000"
Else
harga.Text = "0"
End If
End Sub
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
kode.Items.Add("TS001")
kode.Items.Add("TS002")
kode.Items.Add("VG001")
kode.Items.Add("VG002")
buattabel()
End Sub
Private Sub xit_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles xit.Click
End
End Sub
Private Sub hapus_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles hapus.Click
nama.Text = ""
no.Text = ""
kode.Text = ""
merk.Text = ""
harga.Text = ""
jlh.Text = ""
total.Text = ""
End Sub
Private Sub proses_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles simpan.Click
isitabel()
total.Text = harga.Text * jlh.Text
End Sub
Private Sub Button1_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
lv.Items.Remove(lv.SelectedItems(0))
End Sub
Private Sub Button2_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
lv.Items.Clear()
End Sub
End Class
tampilan saat dicoba, dan disimpan ke listview
Demikilahlah postingan saya Nama : Rahmat Hidayat NPM : 1111370
Selamat Pemrograman VB NET
0 $type={blogger}:
Posting Komentar