Program Visual Basic Net Menghitung Total Nilai Penjualan Pada Isi Listview
Rancanglah form Program Visual Basic Net Menghitung Total Nilai Penjualan Pada Isi Listview berikut ini:
Berikut ini merupakan listing Program Visual Basic Net Menghitung Total Nilai Penjualan Pada Isi Listview
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For i = 1 To 5
Kode.Items.Add("P-00" & i)
Jumlah.Items.Add(i)
Next
With LV
.Columns.Add("Kode", 50, HorizontalAlignment.Center)
.Columns.Add("Nama", 250, HorizontalAlignment.Left)
.Columns.Add("Harga", 50, HorizontalAlignment.Right)
.Columns.Add("Jumlah", 50, HorizontalAlignment.Center)
.Columns.Add("Total Harga", 100, HorizontalAlignment.Right)
.View = View.Details
.GridLines = True
.FullRowSelect = True
End With
End Sub
Private Sub Kode_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Kode.SelectedIndexChanged
Select Case Kode.Text
Case "P-001"
Nama.Text = "Televisi Sony 21 Inchi"
Harga.Text = 2100000
Case "P-002"
Nama.Text = "Televisi Sony 14 Inchi"
Harga.Text = 1900000
Case "P-003"
Nama.Text = "Televisi Sony 29 Inchi"
Harga.Text = 2900000
Case "P-004"
Nama.Text = "Televisi Sony 32 Inchi"
Harga.Text = 3500000
Case "P-005"
Nama.Text = "Televisi Sony 40 Inchi"
Harga.Text = 4500000
Case Else
Nama.Text = ""
Harga.Text = 0
End Select
End Sub
Private Sub Jumlah_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Jumlah.SelectedIndexChanged
Total.Text = Harga.Text * Jumlah.Text
End Sub
Private Sub BtnIsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnIsi.Click
Dim xTP As Double = 0
Dim lst As New ListViewItem
lst.Text = Kode.Text
lst.SubItems.Add(Nama.Text)
lst.SubItems.Add(Harga.Text)
lst.SubItems.Add(Jumlah.Text)
lst.SubItems.Add(Total.Text)
LV.Items.Add(lst)
For i = 0 To LV.Items.Count - 1
xTP = xTP + LV.Items(i).SubItems(4).Text
Next
TotalPenjualan.Text = xTP
End Sub
Private Sub BtnKeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnKeluar.Click
End
End Sub
End Class
Hasil Program Visual Basic Net Menghitung Total Nilai Penjualan Pada Isi Listview.
Tidak ada komentar:
Posting Komentar