Minggu, 08 Desember 2013
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
k_barang.Items.Add("TS001")
k_barang.Items.Add("TS002")
k_barang.Items.Add("VG001")
k_barang.Items.Add("VG002")
BuatTabel()
End Sub
Sub BuatTabel()
LV.Columns.Add(" Nama Pembeli", 80, HorizontalAlignment.Center)
LV.Columns.Add("Kode barang", 100, HorizontalAlignment.Left)
LV.Columns.Add("Merek", 100, HorizontalAlignment.Left)
LV.Columns.Add("Harga", 100, HorizontalAlignment.Left)
LV.Columns.Add("Merek", 100, HorizontalAlignment.Left)
LV.Columns.Add("Jumlah Beli", 100, HorizontalAlignment.Left)
LV.Columns.Add("Total Harga", 100, HorizontalAlignment.Left)
LV.View = View.Details
LV.GridLines = True
LV.FullRowSelect = True
End Sub
Sub IsiTabel()
Dim Lst As New ListViewItem
Lst.Text = nama.Text
Lst.SubItems.Add(k_barang.Text)
Lst.SubItems.Add(merek.Text)
Lst.SubItems.Add(Harga.Text)
Lst.SubItems.Add(jlh.Text)
Lst.SubItems.Add(total.Text)
LV.Items.Add(Lst)
End Sub
Private Sub btnsimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsimpan.Click
IsiTabel()
End Sub
Private Sub Btnhapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnhapus.Click
LV.Items.Clear()
End Sub
Private Sub Btnhapusdata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnhapusdata.Click
LV.Items.Remove(LV.SelectedItems(0))
End Sub
Private Sub k_barang_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles k_barang.SelectedIndexChanged
Dim x As String
x = Strings.Left(k_barang.Text, 2)
Select Case x
Case "TS"
merek.Text = "Toshiba"
Case "VG"
merek.Text = "V-Gen"
End Select
x = Strings.Right(k_barang.Text, 3)
Select Case x
Case "001"
nama.Text = "Falshdisk 4 GB"
Case "002"
nama.Text = "Falshdisk 1 GB"
End Select
x = Strings.Mid(k_barang.Text, 2, 4)
Select Case x
Case "S001"
Harga.Text = 105000
Case "S002"
Harga.Text = 75000
Case "G001"
Harga.Text = 90000
Case "v002"
Harga.Text = 60000
End Select
End Sub
Private Sub jlh_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles jlh.KeyPress
If Asc(e.KeyChar) Then
total.Text = Val(jlh.Text) * Val(Harga.Text)
End If
End Sub
End Class
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar