Public Class Form1
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
Sub
BUATTABEL()
lv.Columns.Add("No.
Pembeian", 80, HorizontalAlignment.Center)
lv.Columns.Add("Kode
Barang", 80, HorizontalAlignment.Center)
lv.Columns.Add("Nama
Barang", 80, 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 L As New ListViewItem
L.Text = no.Text
L.SubItems.Add(kode.Text)
L.SubItems.Add(nama.Text)
L.SubItems.Add(merk.Text)
L.SubItems.Add(harga.Text)
L.SubItems.Add(jumlah.Text)
L.SubItems.Add(toha.Text)
lv.Items.Add(L)
End Sub
Sub smpn(ByVal t As Form)
no.Text = ""
kode.Text = ""
nama.Text = ""
merk.Text = ""
harga.Text = ""
jumlah.Text = ""
toha.Text = ""
End Sub
Private Sub kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles
kode.SelectedIndexChanged
Dim j As String
j =
Microsoft.VisualBasic.Left(kode.Text, 2)
Select Case j
Case
"TS" : merk.Text = "Toshiba"
Case
"VG" : merk.Text = "V-Gen"
End Select
Dim d As String
d =
Microsoft.VisualBasic.Right(kode.Text, 3)
Select Case d
Case
"001" : nama.Text = "Flashdisk 4GB"
Case
"002" : nama.Text = "Flashdisk 2GB"
End Select
Dim c As String
c =
Microsoft.VisualBasic.Mid(kode.Text, 1)
Select Case c
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 btnhapussemuadata_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
btnhapussemuadata.Click
lv.Items.Clear()
End Sub
Private Sub jumlah_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
jumlah.KeyPress
If
Asc(e.KeyChar) = 13 Then
toha.Text = harga.Text *
jumlah.Text
End If
End Sub
Private Sub btnkeluar_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnkeluar.Click
Me.Close()
End Sub
Private Sub btnhapusdatayangdipilih_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
btnhapusdatayangdipilih.Click
lv.Items.Remove(lv.SelectedItems(0))
End Sub
Private Sub btnbersih_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles btnbersih.Click
no.Text = ""
kode.Text = ""
nama.Text = ""
merk.Text = ""
harga.Text = ""
jumlah.Text = ""
toha.Text = ""
End Sub
Private Sub btnsimpankelistview_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles
btnsimpankelistview.Click
ISITABEL()
smpn(Me)
End Sub
End Class
Tidak ada komentar:
Posting Komentar