Public Class Form1
Sub buattabel()
ListView1.Columns.Add("Nomor Pembelian", 80, HorizontalAlignment.Center)
ListView1.Columns.Add("Kode Barang", 80, HorizontalAlignment.Center)
ListView1.Columns.Add("NamaBarang", 80, HorizontalAlignment.Center)
ListView1.Columns.Add("Merek", 80, HorizontalAlignment.Center)
ListView1.Columns.Add("harga", 80, HorizontalAlignment.Center)
ListView1.Columns.Add("jumlah beli", 80, HorizontalAlignment.Center)
ListView1.Columns.Add("Total Harga", 80, HorizontalAlignment.Center)
ListView1.View = View.Details
ListView1.GridLines = True
ListView1.FullRowSelect = True
End Sub
Sub isitabel()
Dim items As New ListViewItem
items.Text = Npembelian.Text
items.SubItems.Add(Npembelian.Text)
items.SubItems.Add(namabrg.Text)
items.SubItems.Add(namabrg.Text)
items.SubItems.Add(merek.Text)
items.SubItems.Add(harga.Text)
items.SubItems.Add(jbeli.Text)
items.SubItems.Add(Tharga.Text)
ListView1.Items.Add(items)
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
kbarang.Items.Add("TS001")
kbarang.Items.Add("TS002")
kbarang.Items.Add("VG001")
kbarang.Items.Add("VG002")
Call buattabel()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Call isitabel()
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
ListView1.Items.Clear()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
End
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Npembelian.Text = ""
kbarang.Text = ""
namabrg.Text = ""
merek.Text = ""
harga.Text = ""
jbeli.Text = ""
Tharga.Text = ""
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
ListView1.Items.Remove(ListView1.SelectedItems(0))
End Sub
Private Sub kode_SelectedIndexChanged(sender As Object, e As EventArgs) Handles kbarang.SelectedIndexChanged
If kbarang.Text = "TS001" Then
namabrg.Text = "FLASDISK 4GB"
merek.Text = "TOSHIBA"
harga.Text = 105000
ElseIf kbarang.Text = "TS002" Then
namabrg.Text = "FLASDISK 2GB"
merek.Text = "TOSHIBA"
harga.Text = 75000
ElseIf kbarang.Text = "VG001" Then
namabrg.Text = "FLASDISK 4GB"
merek.Text = "V-GEN"
harga.Text = 90000
ElseIf kbarang.Text = "VG002" Then
namabrg.Text = "FLASDISK 2GB"
merek.Text = "V-GEN"
harga.Text = 60000
End If
End Sub
Private Sub jbeli_TextChanged(sender As Object, e As EventArgs) Handles jbeli.TextChanged
Tharga.Text = Val(harga.Text) * Val(jbeli.Text)
End Sub
End Class
Tidak ada komentar:
Posting Komentar