Soal Quiz Nomor 2.
Public Class Form1
Sub BuatTabel()
LV1.Columns.Add("Kode", 60, HorizontalAlignment.Center)
LV1.Columns.Add("Namabrg", 100, HorizontalAlignment.Center)
LV1.Columns.Add("Harga", 150, HorizontalAlignment.Center)
LV1.Columns.Add("Merek", 80, HorizontalAlignment.Center)
LV1.Columns.Add("JlhJual", 80, HorizontalAlignment.Center)
LV1.Columns.Add("Total", 100, HorizontalAlignment.Center)
LV1.Columns.Add("Totalpembayaran", 150, HorizontalAlignment.Center)
LV1.View = View.Details
LV1.GridLines = True
End Sub
Sub IsiTabel()
Dim Lst As New ListViewItem
Lst.Text = Kode.Text
Lst.SubItems.Add(Merek.Text)
Lst.SubItems.Add(Namabrg.Text)
Lst.SubItems.Add(Harga.Text)
Lst.SubItems.Add(JlhJual.Text)
Lst.SubItems.Add(Total.Text)
Lst.SubItems.Add(Totalpembayaran.Text)
LV1.Items.Add(Lst)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For i = 1 To 5
JlhJual.Items.Add(i)
Next
BuatTabel()
End Sub
Private Sub Kode_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Kode.TextChanged
Select Case Kode.Text
Case "11" : Namabrg.Text = "Televisi" : Merek.Text = "Sony" : Harga.Text = "1950000"
Case "12" : Namabrg.Text = "Televisi" : Merek.Text = "Samsung" : Harga.Text = "1700000"
Case "13" : Namabrg.Text = "Televisi" : Merek.Text = "Toshiba" : Harga.Text = "180000"
End Select
End Sub
Private Sub BtnKeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnKeluar.Click
End
End Sub
Private Sub BtnHapusData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnHapusData.Click
LV1.Items.Remove(LV1.SelectedItems(0))
End Sub
Private Sub BtnHapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnHapus.Click
LV1.Items.Clear()
End Sub
Private Sub BtnSimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSimpan.Click
IsiTabel()
Kode.Text = ""
Merek.Text = ""
Namabrg.Text = ""
Harga.Text = ""
JlhJual.Text = ""
Total.Text = ""
Pajak.Text = ""
Totalpembayaran.Text = ""
End Sub
Private Sub BtnProses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnProses.Click
Total.Text = JlhJual.Text * Harga.Text
If Total.Text >= 2500000 Then
Pajak.Text = 0.1 * 2500000
Else
Pajak.Text = 0
End If
Totalpembayaran.Text = Total.Text - Pajak.Text
End Sub
Private Sub BtnBersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnBersih.Click
Kode.Text = ""
Merek.Text = ""
Namabrg.Text = ""
Harga.Text = ""
JlhJual.Text = ""
Total.Text = ""
Totalpembayaran.Text = ""
Pajak.Text = ""
End Sub
End Class
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment