LISTING PROGRAM
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
BuatTabel()
KdBarang.Items.Add("TS001")
KdBarang.Items.Add("TS002")
KdBarang.Items.Add("VG001")
KdBarang.Items.Add("VG002")
End Sub
Sub barang()
Dim x As String
x = Microsoft.VisualBasic.Left(KdBarang.Text, 2)
If x = "TS" Then
Merk.Text = "Toshiba"
ElseIf x = "VG" Then
Merk.Text = "V-Gen"
End If
x = Microsoft.VisualBasic.Mid(KdBarang.Text, 3, 3)
If x = "001" Then
NmBarang.Text = "Flasdisk 4GB"
ElseIf x = "002" Then
NmBarang.Text = "Flasdisk 2GB"
End If
If KdBarang.Text = "TS001" Then
Harga.Text = 105000
ElseIf KdBarang.Text = "TS002" Then
Harga.Text = 75000
End If
If KdBarang.Text = "VG001" Then
Harga.Text = 90000
ElseIf KdBarang.Text = "VG002" Then
Harga.Text = 60000
End If
End Sub
Sub BuatTabel()
With LV
.Columns.Add("No Pembelian", 80, HorizontalAlignment.Center)
.Columns.Add("Kode Barang", 120, HorizontalAlignment.Left)
.Columns.Add("Nama Barang", 100, HorizontalAlignment.Left)
.Columns.Add("Merk", 100, HorizontalAlignment.Left)
.Columns.Add("Harga", 100, HorizontalAlignment.Left)
.Columns.Add("Jumlah Beli", 80, HorizontalAlignment.Left)
.Columns.Add("Total Harga", 80, HorizontalAlignment.Left)
.GridLines = True
.FullRowSelect = True
.View = View.Details
End With
End Sub
Sub IsiTabel()
Dim Lst As New ListViewItem
With Lst
.Text = Pembelian.Text()
.SubItems.Add(KdBarang.Text)
.SubItems.Add(NmBarang.Text)
.SubItems.Add(Merk.Text)
.SubItems.Add(Harga.Text)
.SubItems.Add(JlhBeli.Text)
.SubItems.Add(TotalHarga.Text)
LV.Items.Add(Lst)
End With
End Sub
Private Sub kodbrg_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KdBarang.SelectedIndexChanged
Call barang()
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 btndata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndata.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
Pembelian.Text = ""
KdBarang.Text = ""
NmBarang.Text = ""
Merk.Text = ""
Harga.Text = ""
JlhBeli.Text = ""
TotalHarga.Text = ""
End Sub
Private Sub btnkeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnkeluar.Click
End
End Sub
Private Sub jlhbeli_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles JlhBeli.TextChanged
TotalHarga.Text = Val(JlhBeli.Text) * Val(Harga.Text)
End Sub
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
End Sub
Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter
End Sub
End Class
HASIL PROGRAM
Tidak ada komentar:
Posting Komentar