Sub BuatTabel()
lv.Columns.Add("Pembeli",
80, HorizontalAlignment.Center)
lv.Columns.Add("Kode
Barang", 100, HorizontalAlignment.Left)
lv.Columns.Add("Nama
Barang", 100, HorizontalAlignment.Left)
lv.Columns.Add("Merk",
100, HorizontalAlignment.Left)
lv.Columns.Add("Jumlah
Beli", 100, HorizontalAlignment.Left)
lv.Columns.Add("Harga",
100, HorizontalAlignment.Left)
lv.View = View.Details
lv.GridLines = True
lv.FullRowSelect = True
Sub
isitabel()
Dim lst
As New
ListViewItem
lst.Text = pembeli.Text
lst.SubItems.Add(kdbrg.Text)
lst.SubItems.Add(nmbrg.Text)
lst.SubItems.Add(merk.Text)
lst.SubItems.Add(jmlbeli.Text)
lst.SubItems.Add(harga.Text)
lv.Items.Add(lst)
End Sub
Private Sub kdbrg_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
kdbrg.SelectedIndexChanged
Dim X As String
Dim y As String
X =
Microsoft.VisualBasic.Left(kdbrg.Text, 2)
y =
Microsoft.VisualBasic.Right(kdbrg.Text, 3)
Select Case X
Case
"TS" : merk.Text = "Toshiba"
Case
"VG" : merk.Text = "V-GEN"
End Select
Select Case y
Case
"001" : nmbrg.Text = "Flashdisk 4GB"
Case
"002" : nmbrg.Text = "Flashdisk 2GB"
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 = 50000
ElseIf
X = "VG" And
y = "002" Then
harga.Text = 80000
End If
End Sub
Private Sub Form2_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
BuatTabel()
kdbrg.Items.Add("TS001")
kdbrg.Items.Add("TS002")
kdbrg.Items.Add("VG001")
kdbrg.Items.Add("VG002")
End Sub
Private Sub btnbatal_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnbatal.Click
pembeli.Text = ""
kdbrg.Text = ""
nmbrg.Text = ""
merk.Text = ""
jmlbeli.Text = ""
harga.Text = ""
End Sub
Private Sub btnhps_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnhps.Click
End
End Sub
Private Sub pembeli_TextChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles pembeli.TextChanged
End Sub
Private Sub ListView1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
lv.SelectedIndexChanged
End Sub
Private Sub hapussemua_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles hapussemua.Click
lv.Items.Clear()
End Sub
Private Sub hapusdipilih_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles hapusdipilih.Click
lv.Items.Remove(lv.SelectedItems(0))
End Sub
Private Sub simpan_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles simpan.Click
isitabel()
pembeli.Text = ""
kdbrg.Text = ""
nmbrg.Text = ""
merk.Text = ""
jmlbeli.Text = ""
harga.Text = ""
End Sub
End Class
0 comments:
Post a Comment