HASIL PROGRAM SOAL NO 1.
Public Class Form2
Sub buattabel()
LV.Columns.Add("pembelian", 80, HorizontalAlignment.Center)
LV.Columns.Add("kode barang", 80, HorizontalAlignment.Left)
LV.Columns.Add("nama barang", 120, HorizontalAlignment.Left)
LV.Columns.Add("merk", 80, HorizontalAlignment.Left)
LV.Columns.Add("harga", 80, HorizontalAlignment.Left)
LV.Columns.Add("jmlh beli", 80, HorizontalAlignment.Left)
LV.Columns.Add("ttl harga", 80, HorizontalAlignment.Left)
LV.View = View.Details
LV.GridLines = True
LV.FullRowSelect = True
End Sub
Sub isitable()
Dim lst As New ListViewItem
lst.Text = pembelian.Text
lst.SubItems.Add(kd_brg.Text)
lst.SubItems.Add(nm_brg.Text)
lst.SubItems.Add(merk.Text)
lst.SubItems.Add(harga.Text)
lst.SubItems.Add(jlh_beli.Text)
lst.SubItems.Add(ttl_harga.Text)
LV.Items.Add(lst)
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
kd_brg.Items.Add("TS001")
kd_brg.Items.Add("TS002")
kd_brg.Items.Add("VG001")
kd_brg.Items.Add("VG002")
buattabel()
End Sub
Private Sub kd_brg_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kd_brg.SelectedIndexChanged
Dim X As String
X = Microsoft.VisualBasic.Left(kd_brg.Text, 2)
Select Case X
Case "TS" : merk.Text = "TOSIBA"
Case "VG" : merk.Text = "V-GEN"
End Select
X = Microsoft.VisualBasic.Right(kd_brg.Text, 5)
Select Case X
Case "TS001" : nm_brg.Text = "FLASDISK 4 GB" : harga.Text = "1050000"
Case "TS002" : nm_brg.Text = "FLASDISK 2 GB" : harga.Text = "75000"
Case "VG001" : nm_brg.Text = "FLASDISK 4 GB" : harga.Text = "90000"
Case "VG002" : nm_brg.Text = "FLASDISK 2 GB" : harga.Text = "60000"
End Select
End Sub
Private Sub simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan.Click
ttl_harga.Text = harga.Text * jlh_beli.Text
isitable()
pembelian.Text = ""
kd_brg.Text = ""
nm_brg.Text = ""
merk.Text = ""
harga.Text = ""
jlh_beli.Text = ""
ttl_harga.Text = ""
End Sub
Private Sub keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles keluar.Click
Close()
End Sub
Private Sub hps_data_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hps_data.Click
LV.Items.Clear()
End Sub
Private Sub hps_dipilih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hps_dipilih.Click
LV.Items.Remove(LV.SelectedItems(0))
End Sub
End Class
Sub buattabel()
LV.Columns.Add("pembelian", 80, HorizontalAlignment.Center)
LV.Columns.Add("kode barang", 80, HorizontalAlignment.Left)
LV.Columns.Add("nama barang", 120, HorizontalAlignment.Left)
LV.Columns.Add("merk", 80, HorizontalAlignment.Left)
LV.Columns.Add("harga", 80, HorizontalAlignment.Left)
LV.Columns.Add("jmlh beli", 80, HorizontalAlignment.Left)
LV.Columns.Add("ttl harga", 80, HorizontalAlignment.Left)
LV.View = View.Details
LV.GridLines = True
LV.FullRowSelect = True
End Sub
Sub isitable()
Dim lst As New ListViewItem
lst.Text = pembelian.Text
lst.SubItems.Add(kd_brg.Text)
lst.SubItems.Add(nm_brg.Text)
lst.SubItems.Add(merk.Text)
lst.SubItems.Add(harga.Text)
lst.SubItems.Add(jlh_beli.Text)
lst.SubItems.Add(ttl_harga.Text)
LV.Items.Add(lst)
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
kd_brg.Items.Add("TS001")
kd_brg.Items.Add("TS002")
kd_brg.Items.Add("VG001")
kd_brg.Items.Add("VG002")
buattabel()
End Sub
Private Sub kd_brg_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kd_brg.SelectedIndexChanged
Dim X As String
X = Microsoft.VisualBasic.Left(kd_brg.Text, 2)
Select Case X
Case "TS" : merk.Text = "TOSIBA"
Case "VG" : merk.Text = "V-GEN"
End Select
X = Microsoft.VisualBasic.Right(kd_brg.Text, 5)
Select Case X
Case "TS001" : nm_brg.Text = "FLASDISK 4 GB" : harga.Text = "1050000"
Case "TS002" : nm_brg.Text = "FLASDISK 2 GB" : harga.Text = "75000"
Case "VG001" : nm_brg.Text = "FLASDISK 4 GB" : harga.Text = "90000"
Case "VG002" : nm_brg.Text = "FLASDISK 2 GB" : harga.Text = "60000"
End Select
End Sub
Private Sub simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan.Click
ttl_harga.Text = harga.Text * jlh_beli.Text
isitable()
pembelian.Text = ""
kd_brg.Text = ""
nm_brg.Text = ""
merk.Text = ""
harga.Text = ""
jlh_beli.Text = ""
ttl_harga.Text = ""
End Sub
Private Sub keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles keluar.Click
Close()
End Sub
Private Sub hps_data_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hps_data.Click
LV.Items.Clear()
End Sub
Private Sub hps_dipilih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hps_dipilih.Click
LV.Items.Remove(LV.SelectedItems(0))
End Sub
End Class
Tidak ada komentar:
Posting Komentar