Public Class Form1
Private Sub Label9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label9.Click
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
kp.Items.Add("001")
kp.Items.Add("002")
Call Rancang_table()
End Sub
Private Sub kp_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kp.SelectedIndexChanged
Select Case kp.Text
Case "001"
kb.Items.Add("KB01")
kb.Items.Add("KB02")
Case "002"
kb.Items.Add("KP01")
kb.Items.Add("KP02")
End Select
End Sub
Private Sub Proses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Proses.Click
If jumlah.Text = "1" Then
th.Text = 1 * harga.Text
diskon.Text = 0.1 * th.Text
tb.Text = th.Text - diskon.Text
ElseIf jumlah.Text = "2" Then
th.Text = 2 * harga.Text
diskon.Text = 0.1 * th.Text
tb.Text = th.Text - diskon.Text
ElseIf jumlah.Text = "3" Then
th.Text = 3 * harga.Text
diskon.Text = 0.1 * th.Text
tb.Text = th.Text - diskon.Text
ElseIf jumlah.Text = "4" Then
th.Text = 4 * harga.Text
diskon.Text = 0.1 * th.Text
tb.Text = th.Text - diskon.Text
ElseIf jumlah.Text = "5" Then
th.Text = 5 * harga.Text
diskon.Text = 0.1 * th.Text
tb.Text = th.Text - diskon.Text
ElseIf jumlah.Text = "6" Then
th.Text = 6 * harga.Text
diskon.Text = 0.1 * th.Text
tb.Text = th.Text - diskon.Text
ElseIf jumlah.Text = "7" Then
th.Text = 7 * harga.Text
diskon.Text = 0.1 * th.Text
tb.Text = th.Text - diskon.Text
ElseIf jumlah.Text = "8" Then
th.Text = 8 * harga.Text
diskon.Text = 0.1 * th.Text
tb.Text = th.Text - diskon.Text
ElseIf jumlah.Text = "9" Then
th.Text = 9 * harga.Text
diskon.Text = 0.1 * th.Text
tb.Text = th.Text - diskon.Text
End If
End Sub
Private Sub Keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Keluar.Click
End
End Sub
Private Sub mb_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mb.SelectedIndexChanged
If mb.Text = "Nokia" Then
harga.Text = "750000"
ElseIf mb.Text = "Sony" Then
harga.Text = "600000"
ElseIf mb.Text = "Samsung" Then
harga.Text = "1000000"
ElseIf mb.Text = "LG" Then
harga.Text = "2000000"
End If
End Sub
Private Sub kb_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb.SelectedIndexChanged
Select Case kb.Text
Case "KB01"
nb.Items.Add("HP")
Case "KB02"
nb.Items.Add("TV")
Case "KP01"
nb.Items.Add("HP")
Case "KP02"
nb.Items.Add("TV")
End Select
End Sub
Private Sub nb_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nb.SelectedIndexChanged
Select Case nb.Text
Case "HP"
mb.Items.Add("Nokia")
mb.Items.Add("Sony")
Case "TV"
mb.Items.Add("LG")
mb.Items.Add("Samsung")
End Select
End Sub
Private Sub pembayaran_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles pembayaran.KeyPress
If e.KeyChar = Chr(13) Then
sp.Text = Val(pembayaran.Text) - Val(tb.Text)
End If
End Sub
Private Sub pembayaran_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles pembayaran.TextChanged
End Sub
Sub Rancang_table()
With lv
.Columns.Add("kp", 80, HorizontalAlignment.Center)
.Columns.Add("kb", 80, HorizontalAlignment.Center)
.Columns.Add("nb", 80, HorizontalAlignment.Center)
.Columns.Add("mb", 80, HorizontalAlignment.Center)
.Columns.Add("jumlah", 80, HorizontalAlignment.Center)
.Columns.Add("th", 80, HorizontalAlignment.Center)
.Columns.Add("diskon", 80, HorizontalAlignment.Center)
.Columns.Add("tb", 80, HorizontalAlignment.Center)
.Columns.Add("pembayaran", 80, HorizontalAlignment.Center)
.Columns.Add("sp", 80, HorizontalAlignment.Center)
.View = View.Details
.GridLines = True
.FullRowSelect = True
End With
End Sub
Sub Isi_Tabel()
Dim lst As New ListViewItem
With lst
.Text = kp.Text
.SubItems.Add(kb.Text)
.SubItems.Add(nb.Text)
.SubItems.Add(mb.Text)
.SubItems.Add(harga.Text)
.SubItems.Add(jumlah.Text)
.SubItems.Add(th.Text)
.SubItems.Add(diskon.Text)
.SubItems.Add(pembayaran.Text)
.SubItems.Add(sp.Text)
End With
lv.Items.Add(lst)
End Sub
Private Sub Hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hapus.Click
kp.Text = ""
kb.Text = ""
nb.Text = ""
mb.Text = ""
harga.Text = ""
jumlah.Text = ""
th.Text = ""
diskon.Text = ""
tb.Text = ""
pembayaran.Text = ""
sp.Text = ""
End Sub
Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan.Click
Call Isi_Tabel()
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
lv.Items.Remove(lv.SelectedItems(0))
End Sub
End Class
hasil tampilan program:
Tidak ada komentar:
Posting Komentar