Selesaikanlah Kasus Berikut :
JUDUL SOAL : Kasus Pemrograman : Informasi Penjualan Produk
Berikut Jawaban Program :
Public Class BTNInformasipenjualanproduk
Private Sub BTNInformasipenjualanproduk_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
kode.Items.Add("1")
kode.Items.Add("2")
kode.Items.Add("3")
buattabel()
End Sub
Sub buattabel()
lv.Columns.Add("No", 80, HorizontalAlignment.Center)
lv.Columns.Add("Kode", 60, HorizontalAlignment.Left)
lv.Columns.Add("Produk", 100, HorizontalAlignment.Left)
LV.Columns.Add("Harga", 80, HorizontalAlignment.Left)
lv.Columns.Add("Jumlah", 60, HorizontalAlignment.Left)
lv.Columns.Add("Total", 80, HorizontalAlignment.Left)
LV.View = View.Details
LV.GridLines = True
LV.FullRowSelect = True
End Sub
Sub isitable()
Dim lst As New ListViewItem
lst.Text = NO.Text
lst.SubItems.Add(kode.Text)
lst.SubItems.Add(PRODUK.Text)
lst.SubItems.Add(Harga.Text)
lst.SubItems.Add(JUMLAH.Text)
lst.SubItems.Add(TOTAL.Text)
LV.Items.Add(lst)
End Sub
Private Sub kodebarang_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kode.SelectedIndexChanged
Select Case kode.Text
Case "1" : PRODUK.Text = "TV" : Harga.Text = "2000000"
Case "2" : PRODUK.Text = "DVD" : Harga.Text = "650000"
Case "3" : PRODUK.Text = "CD ROOM" : Harga.Text = "450000"
End Select
End Sub
Private Sub kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kode.SelectedIndexChanged
Select Case kode.Text
Case "1" : PRODUK.Text = "TV" : Harga.Text = "2000000"
Case "2" : PRODUK.Text = "DVD" : Harga.Text = "650000"
Case "3" : PRODUK.Text = "CD ROOM" : Harga.Text = "450000"
End Select
End Sub
Private Sub JUMLAH_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles JUMLAH.KeyPress
End Sub
Private Sub JUMLAH_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles JUMLAH.TextChanged
End Sub
Private Sub BTNHapusList_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles keluar.Click
Close()
End Sub
Private Sub Btnsimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnsimpan.Click
isitable()
NO.Text = ""
kode.Text = ""
PRODUK.Text = ""
Harga.Text = ""
JUMLAH.Text = ""
TOTAL.Text = ""
End Sub
Private Sub BTNBatal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNBatal.Click
NO.Text = ""
kode.Text = ""
PRODUK.Text = ""
Harga.Text = ""
JUMLAH.Text = ""
TOTAL.Text = ""
End Sub
Private Sub BTNKeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNKeluar.Click
lv.Items.Clear()
End Sub
Private Sub BTNProses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNProses.Click
TOTAL.Text = Val(Harga.Text * JUMLAH.Text)
End Sub
End Class
Berikut Tampilan Program :
Demikilahlah postingan saya Nama : (Ari Andini) NPM : (14110630)
Selamat Belajar Pemrograman VB NET