Listing Program :
Public Class Form1
Dim i As Byte
Sub buattable()
LV.Columns.Add("No", 50, HorizontalAlignment.Center)
LV.Columns.Add("Tipe", 80, HorizontalAlignment.Center)
LV.Columns.Add("Nama", 180, HorizontalAlignment.Center)
LV.Columns.Add("Hargam3", 180, HorizontalAlignment.Center)
LV.Columns.Add("Biayabeban", 180, HorizontalAlignment.Center)
LV.Columns.Add("Pemakaianair", 180, HorizontalAlignment.Center)
LV.Columns.Add("Totaltagihan", 180, HorizontalAlignment.Center)
LV.Columns.Add("Pajak", 180, HorizontalAlignment.Center)
LV.Columns.Add("Pembayaran", 180, HorizontalAlignment.Center)
LV.Columns.Add("Daerah", 180, HorizontalAlignment.Center)
LV.View = View.Details
LV.GridLines = True
LV.FullRowSelect = True
End Sub
Sub isitable()
Dim lst As New ListViewItem
lst.Text = i
lst.SubItems.Add(tipe.Text)
lst.SubItems.Add(nama.Text)
lst.SubItems.Add(hargam3.Text)
lst.SubItems.Add(biayabeban.Text)
lst.SubItems.Add(pemakaianair.Text)
lst.SubItems.Add(totaltagihan.Text)
lst.SubItems.Add(pajak.Text)
lst.SubItems.Add(pembayaran.Text)
lst.SubItems.Add(daerah.Text)
LV.Items.Add(lst)
i = i + 1
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
buattable()
Kodepelanggan.Items.Add("TOK-MED-100")
Kodepelanggan.Items.Add("PAB-BEL-101")
Kodepelanggan.Items.Add("SWA-BEL-102")
Kodepelanggan.Items.Add("PAB-MED-103")
Kodepelanggan.Items.Add("RUM-MED-104")
i = 1
End Sub
Private Sub Btnhapusdataygdplih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnhapusdataygdplih.Click
LV.Items.Remove(LV.SelectedItems(0))
End Sub
Private Sub Btnhapussemuadata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnhapussemuadata.Click
LV.Items.Clear()
End Sub
Private Sub Btnsimpanke_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnsimpanke.Click
isitable()
tipe.Text = ""
nama.Text = ""
hargam3.Text = ""
biayabeban.Text = ""
pemakaianair.Text = ""
totaltagihan.Text = ""
pajak.Text = ""
pembayaran.Text = ""
daerah.Text = ""
End Sub
Private Sub Kodepelanggan_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Kodepelanggan.SelectedIndexChanged
Dim x As String
x = Microsoft.VisualBasic.Right(Kodepelanggan.Text, 3)
If x = "100" Then
nama.Text = "Hidayat"
ElseIf x = "101" Then
nama.Text = "Reza l"
ElseIf x = "102" Then
nama.Text = "Canif"
ElseIf x = "103" Then
nama.Text = "Jilam"
End If
x = Microsoft.VisualBasic.Left(Kodepelanggan.Text, 3)
If x = "PAB" Then
hargam3.Text = 500
biayabeban.Text = 250000
tipe.Text = "Pabrik"
ElseIf x = "TOK" Then
hargam3.Text = 500
biayabeban.Text = 25000
tipe.Text = "Toko"
ElseIf x = "RUM" Then
hargam3.Text = 500
biayabeban.Text = 10000
tipe.Text = "Rumah"
ElseIf x = "SWA" Then
hargam3.Text = 200
biayabeban.Text = 15000
tipe.Text = "Swalayan"
End If
x = Microsoft.VisualBasic.Mid(Kodepelanggan.Text, 5, 3)
If x = "MED" Then
daerah.Text = "Medan"
ElseIf x = "BEL" Then
daerah.Text = "Belawan"
End If
End Sub
Private Sub pemakaianair_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles pemakaianair.KeyPress
If e.KeyChar = Chr(13) Then
If Asc(e.KeyChar) = 13 Then
totaltagihan.Text = hargam3.Text * pemakaianair.Text + Val(biayabeban.Text)
pajak.Text = 0.01 * totaltagihan.Text
pembayaran.Text = Val(totaltagihan.Text) + Val(pajak.Text)
End If
End If
End Sub
Private Sub Btnkeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnkeluar.Click
End
End Sub
Private Sub LV_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LV.SelectedIndexChanged
End Sub
End Class
Home »
» Contoh Program PDAM menggunakan VB.NET
0 komentar:
Speak up your mind
Tell us what you're thinking... !