listing program:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
KP.Items.Add("PAB-MED-100")
KP.Items.Add("TOK-BEL-101")
KP.Items.Add("TOK-BEL-102")
KP.Items.Add("RUM-MED-103")
Call rancang_table()
End Sub
Private Sub KP_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KP.SelectedIndexChanged
Dim x As String
x = Microsoft.VisualBasic.Right(KP.Text, 3)
Select Case x
Case "100"
Nama.Text = "Jhon SE"
Case "101"
Nama.Text = "Eko P"
Case "102"
Nama.Text = "Susi W"
End Select
x = Microsoft.VisualBasic.Left(KP.Text, 3)
Select Case x
Case "TOK"
Type.Text = "TOKO"
HargaM3.Text = 300
BBeban.Text = 25000
Case "RUM"
Type.Text = "RUMAH"
HargaM3.Text = 100
BBeban.Text = 10000
Case "SWA"
Type.Text = "SWALAYAN"
HargaM3.Text = 200
BBeban.Text = 15000
Case "PAB"
Type.Text = "Pabrik"
HargaM3.Text = 500
BBeban.Text = 250000
End Select
x = Microsoft.VisualBasic.Mid(KP.Text, 5, 3)
If x = "MED" Then
Daerah.Text = "Medan"
ElseIf x = "BEL" Then
Daerah.Text = "Belawan"
End If
End Sub
Private Sub JPemakaian_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles JPemakaian.KeyPress
If Asc(e.KeyChar) = 13 Then
Tagihan.Text = Val(BBeban.Text) + HargaM3.Text * JPemakaian.Text
Pajak.Text = 0.01 * Tagihan.Text
Pembayaran.Text = Val(Pajak.Text) + Val(JPemakaian.Text)
End If
End Sub
Private Sub JPemakaian_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles JPemakaian.TextChanged
End Sub
Private Sub Keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Keluar.Click
End
End Sub
Private Sub Hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hapus.Click
KP.Text = ""
Nama.Text = ""
Type.Text = ""
BBeban.Text = ""
JPemakaian.Text = ""
Tagihan.Text = ""
Pembayaran.Text = ""
Daerah.Text = ""
HargaM3.Text = ""
Pajak.Text = ""
End Sub
Sub rancang_table()
With lv
.Columns.Add("KP", 80, HorizontalAlignment.Center)
.Columns.Add("NP", 80, HorizontalAlignment.Center)
.Columns.Add("tipe", 80, HorizontalAlignment.Center)
.Columns.Add("biaya beban", 80, HorizontalAlignment.Center)
.Columns.Add("jumlah ", 80, HorizontalAlignment.Center)
.Columns.Add("total ", 80, HorizontalAlignment.Center)
.Columns.Add("pembayaran", 80, HorizontalAlignment.Center)
.Columns.Add("derah", 80, HorizontalAlignment.Center)
.Columns.Add("harga m3", 80, HorizontalAlignment.Center)
.Columns.Add("pajak", 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(KP.Text)
.SubItems.Add(Nama.Text)
.SubItems.Add(Type.Text)
.SubItems.Add(BBeban.Text)
.SubItems.Add(JPemakaian.Text)
.SubItems.Add(Tagihan.Text)
.SubItems.Add(Pembayaran.Text)
.SubItems.Add(Daerah.Text)
.SubItems.Add(HargaM3.Text)
.SubItems.Add(Pajak.Text)
End With
lv.Items.Add(lst)
End Sub
Private Sub simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan.Click
Call Isi_Tabel()
End Sub
End Class
hasil output: