Public Class Form1
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
table()
End Sub
Sub table()
ListView1.Columns.Add("Kode", 100, HorizontalAlignment.Left)
ListView1.Columns.Add("Jenis Pelanggan", 100,
HorizontalAlignment.Center)
ListView1.Columns.Add("Beban", 100,
HorizontalAlignment.Center)
ListView1.Columns.Add("Harga", 100,
HorizontalAlignment.Center)
ListView1.Columns.Add("Pemakaian", 100,
HorizontalAlignment.Center)
ListView1.Columns.Add("Pembayaran", 100,
HorizontalAlignment.Center)
ListView1.GridLines = True
ListView1.FullRowSelect = True
ListView1.View = View.Details
End Sub
Sub
isi_table()
Dim lst
As New
ListViewItem
lst.Text = kode.Text
lst.SubItems.Add(jenis_pelanggan.Text)
lst.SubItems.Add(beban.Text)
lst.SubItems.Add(harga.Text)
lst.SubItems.Add(pemakaian.Text)
lst.SubItems.Add(pembayaran.Text)
ListView1.Items.Add(lst)
End Sub
Private Sub TextBox1_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
kode.KeyPress
If
Asc(e.KeyChar) = 13 Then
If
kode.Text = "1" Then
jenis_pelanggan.Text = "Rumah"
beban.Text = 2500
harga.Text = 3000
ElseIf
kode.Text = "2" Then
jenis_pelanggan.Text = "Toko"
beban.Text = 50000
harga.Text = 5000
ElseIf
kode.Text = "3" Then
jenis_pelanggan.Text = "Pabrik"
beban.Text = 100000
harga.Text = 10000
End
If
End If
End Sub
Private Sub TextBox1_TextChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles kode.TextChanged
End Sub
Private Sub pemakaian_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
pemakaian.KeyPress
If
Asc(e.KeyChar) = 13 Then
If
pemakaian.Text = "" Then
MsgBox("Isi
Dulu gan")
Else
pembayaran.Text =
Val(beban.Text) + (harga.Text * pemakaian.Text)
End
If
End If
End Sub
Private Sub Button1_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
isi_table()
End Sub
Private Sub Button3_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Me.Close()
End Sub
End Class
EmoticonEmoticon