Program
untuk menampilkan hasil ke listview untuk kasus Pemakaian Listrik :
Berikut Coding nya :
Public Class Form1
Public
Perintah As String
Private Sub ke_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
ke.KeyPress
Dim
tombol2 As Integer
= Asc(e.KeyChar)
Dim x As String
If
tombol2 = 13 Then
If
ke.Text = "" Then
MsgBox("Masukkan
Untuk Berapa Bulan!")
Else
pemakaian.Text = ke.Text *
100000
denda.Text = pemakaian.Text * 0.1
End
If
End If
End Sub
Sub
BuatTabel()
LV.Columns.Add("Untuk
Bulan", 80, HorizontalAlignment.Center)
LV.Columns.Add("Ke",
80, HorizontalAlignment.Center)
LV.Columns.Add("Pemakaian",
80, HorizontalAlignment.Center)
LV.Columns.Add("Denda",
80, HorizontalAlignment.Center)
LV.Columns.Add("Total
Bayar", 80, HorizontalAlignment.Center)
LV.View = View.Details
LV.GridLines = True
LV.FullRowSelect = True
End Sub
Sub
IsiTabel()
Dim Lst
As New
ListViewItem
Lst.Text = bulan.Text
Lst.SubItems.Add(ke.Text)
Lst.SubItems.Add(pemakaian.Text)
Lst.SubItems.Add(denda.Text)
Lst.SubItems.Add(totalbayar.Text)
LV.Items.Add(Lst)
End Sub
Private Sub BtnProses_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BtnProses.Click
totalbayar.Text = Val(pemakaian.Text) +
Val(denda.Text)
End Sub
Private Sub cmdsimpan_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles LST.Click
IsiTabel()
bulan.Text = ""
ke.Text = ""
pemakaian.Text = ""
denda.Text = ""
totalbayar.Text = ""
End Sub
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
BuatTabel()
End Sub
End Class
Berikut hasil nya…
NAMA : Jhon Carlos Situmorang
NPM : 1111539
NPM : 1111539
KELAS : TI P1106
Selamat Pemrograman VB NET
Selamat Pemrograman VB NET