Selesaikanlah Kasus Berikut :
SOAL 1 : Buatlah program untuk menampilkan hasil ke listview untuk kasus latihan listview perhitungan penjualan barang
Berikut Jawaban Program :
Design Data Perhitungan Penjualan Barang Dengan Menggunakan Listview Pada Pemrograman Visual Basic.Net
Listing Programnya :
Public Class Form1
Sub BuatTabel()
LV.Columns.Add("No Pembelian", 120, HorizontalAlignment.Center)
LV.Columns.Add("Kode Barang", 120, HorizontalAlignment.Center)
LV.Columns.Add("Nama Barang", 120, HorizontalAlignment.Center)
LV.Columns.Add("Merk", 100, HorizontalAlignment.Center)
LV.Columns.Add("Harga", 100, HorizontalAlignment.Center)
LV.Columns.Add("Jumlah Beli", 120, HorizontalAlignment.Center)
LV.Columns.Add("TotalHarga", 100, HorizontalAlignment.Center)
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(nama.Text)
Lst.SubItems.Add(merk.Text)
Lst.SubItems.Add(harga.Text)
Lst.SubItems.Add(jumlah.Text)
Lst.SubItems.Add(total.Text)
LV.Items.Add(Lst)
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kode.SelectedIndexChanged
Dim x As String
x = Microsoft.VisualBasic.Left(kode.Text, 2)
If x = "TS" Then
merk.Text = "Thosiba"
ElseIf x = "VG" Then
merk.Text = "V-Gen"
End If
x = Microsoft.VisualBasic.Right(kode.Text, 3)
If x = "001" Then
nama.Text = "Flashdisk 4GB"
ElseIf x = "002" Then
nama.Text = "Flashdisk 2GB"
End If
If kode.Text = "TS001" Then
harga.Text = "105000"
ElseIf kode.Text = "TS002" Then
harga.Text = "75000"
ElseIf kode.Text = "VG001" Then
harga.Text = "90000"
ElseIf kode.Text = "VG002" Then
harga.Text = "60000"
End If
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
BuatTabel()
kode.Items.Add("TS001")
kode.Items.Add("TS002")
kode.Items.Add("VG001")
kode.Items.Add("VG002")
End Sub
Private Sub total_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles total.TextChanged
End Sub
Private Sub jumlah_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles jumlah.KeyPress
Dim tombol As Integer = Asc(e.KeyChar)
If tombol = 13 Then
total_TextChanged(sender, e)
total.Text = jumlah.Text * harga.Text
End If
End Sub
Private Sub jumlah_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jumlah.TextChanged
End Sub
Private Sub BtnSimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSimpan.Click
IsiTable()
No.Text = ""
kode.Text = ""
nama.Text = ""
merk.Text = ""
harga.Text = ""
jumlah.Text = ""
total.Text = ""
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
No.Text = ""
kode.Text = ""
nama.Text = ""
merk.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
End
End Sub
End Class
Berikut Hasil Program Data Perhitungan Penjualan Barang Dengan Menggunakan Listview Pada Pemrograman Visual Basic.Net
SOAL 2 : Buatlah program vb net untuk menampilkan output seperti dibawah ini :
Buatlah program untuk mencari total pembayaran tv
PENJUALAN TV. SONY
--------------------------------------------
Nama Barang : ?
Harga : ?
Jumlah Jual : ?
Total Harga :
Discount :
Total Pembayaran:
--------------------------------------------
Proses
Total Harga = Harga * Jumlah Jual
Jika Total Harga > 2500000 maka
Discount = 10% * Total Harga
atau
Discount = 0
Total Pembayaran = Total Harga - Discount
--------------------------------------------
Nama Barang : ?
Harga : ?
Jumlah Jual : ?
Total Harga :
Discount :
Total Pembayaran:
--------------------------------------------
Proses
Total Harga = Harga * Jumlah Jual
Jika Total Harga > 2500000 maka
Discount = 10% * Total Harga
atau
Discount = 0
Total Pembayaran = Total Harga - Discount
Berikut Jawaban Program :
Design Data Penjualan Tv Dengan Menggunakan Listview Pada Pemrograman Visual Basic.Net
Listing Programnya :
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
NamaBarang.Items.Add("sony")
NamaBarang.Items.Add("LG")
NamaBarang.Items.Add("Panasonic")
NamaBarang.Items.Add("Politron")
End Sub
Private Sub NamaBarang_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NamaBarang.SelectedIndexChanged
Select Case NamaBarang.Text
Case "Sony" : Harga.Text = 1750000
Case "LG" : Harga.Text = 2500000
Case "Panosinic" : Harga.Text = 3250000
Case "Politron" : Harga.Text = 1000000
End Select
End Sub
Private Sub BtnProses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnProses.Click
Total.Text = Harga.Text * jmlh.Text
If Total.Text > 2500000 Then
Disc.Text = 0.01 * Total.Text
Else : Disc.Text = 0
End If
Pembayaran.Text = Val(Total.Text) - Val(Disc.Text)
End Sub
Private Sub BtnBersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnBersih.Click
NamaBarang.Text = ""
Harga.Text = ""
jmlh.Text = ""
Total.Text = ""
Disc.Text = ""
Pembayaran.Text = ""
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
End
End Sub
End Class
Berikut Hasil Program Data Penjualan Tv Pada Pemrograman Visual Basic.Net
Demikilahlah postingan saya, Nama : Muhammad Syahril NPM : 1111110
Selamat Belajar Pemrograman Vb.Net
Tidak ada komentar