Public Class Form1
Private Sub jlh_lembar_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs)
If
jlh_lembar.Text >= 1 Then
Harga_barang.Text = 50
ElseIf
jlh_lembar.Text >= 100 Then
Harga_barang.Text = 70
ElseIf
jlh_lembar.Text >= 200 Then
Harga_barang.Text = 100
End If
ttl_harga.Text = Harga_barang.Text *
jlh_lembar.Text
End Sub
Private Sub Form1_Load_1(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim
halaman As Byte
halaman = 1
While
halaman <= 200
jlh_lembar.Items.Add(halaman)
halaman = halaman + 1
End While
End Sub
End Class
Latihan Listview Perhitungan Penjualan Barang
input data program
Hasil program
Public Class Form2
Sub
buattabel()
LV.Columns.Add("pembelian",
80, HorizontalAlignment.Center)
LV.Columns.Add("kode
barang", 80, HorizontalAlignment.Left)
LV.Columns.Add("nama
barang", 120, HorizontalAlignment.Left)
LV.Columns.Add("merk",
80, HorizontalAlignment.Left)
LV.Columns.Add("harga",
80, HorizontalAlignment.Left)
LV.Columns.Add("jmlh
beli", 80, HorizontalAlignment.Left)
LV.Columns.Add("ttl
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 = pembelian.Text
lst.SubItems.Add(kd_brg.Text)
lst.SubItems.Add(nm_brg.Text)
lst.SubItems.Add(merk.Text)
lst.SubItems.Add(harga.Text)
lst.SubItems.Add(jlh_beli.Text)
lst.SubItems.Add(ttl_harga.Text)
LV.Items.Add(lst)
End Sub
Private Sub Form2_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
kd_brg.Items.Add("TS001")
kd_brg.Items.Add("TS002")
kd_brg.Items.Add("VG001")
kd_brg.Items.Add("VG002")
buattabel()
End Sub
Private Sub kd_brg_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
kd_brg.SelectedIndexChanged
Dim X As String
X =
Microsoft.VisualBasic.Left(kd_brg.Text, 2)
Select Case X
Case
"TS" : merk.Text = "TOSIBA"
Case
"VG" : merk.Text = "V-GEN"
End Select
X =
Microsoft.VisualBasic.Right(kd_brg.Text, 5)
Select Case X
Case
"TS001" : nm_brg.Text = "FLASDISK 4 GB" : harga.Text = "1050000"
Case
"TS002" : nm_brg.Text = "FLASDISK 2 GB" : harga.Text = "75000"
Case
"VG001" : nm_brg.Text = "FLASDISK 4 GB" : harga.Text = "90000"
Case
"VG002" : nm_brg.Text = "FLASDISK 2 GB" : harga.Text = "60000"
End Select
End Sub
Private Sub simpan_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles simpan.Click
ttl_harga.Text = harga.Text *
jlh_beli.Text
isitable()
pembelian.Text = ""
kd_brg.Text = ""
nm_brg.Text = ""
merk.Text = ""
harga.Text = ""
jlh_beli.Text = ""
ttl_harga.Text = ""
End Sub
Private Sub keluar_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles keluar.Click
Close()
End Sub
Private Sub hps_data_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles hps_data.Click
LV.Items.Clear()
End Sub
Private Sub hps_dipilih_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles hps_dipilih.Click
LV.Items.Remove(LV.SelectedItems(0))
End Sub
Private Sub bersih_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles bersih.Click
End Sub
End Class
Tidak ada komentar:
Posting Komentar