Contoh Desaign Program Listview Penggajian Pegawai :
Berikut merupakan listing program penggajian Pegawai…..
Public Class Form1
Private Sub Label1_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Label1.Click
End Sub
Sub
BuatTabel()
ListView1.Columns.Add("NIK", 80, HorizontalAlignment.Center)
ListView1.Columns.Add("NAMA", 140, HorizontalAlignment.Left)
ListView1.Columns.Add("JABATAN", 80,
HorizontalAlignment.Center)
ListView1.Columns.Add("GAJI", 80, HorizontalAlignment.Center)
ListView1.Columns.Add("STATUS", 80,
HorizontalAlignment.Center)
ListView1.Columns.Add("Tunj_Istri", 80,
HorizontalAlignment.Center)
ListView1.Columns.Add("J_Anak", 80,
HorizontalAlignment.Center)
ListView1.Columns.Add("Tunj_Anak", 80, HorizontalAlignment.Center)
ListView1.Columns.Add("J_Lembur", 80,
HorizontalAlignment.Center)
ListView1.Columns.Add("H_Lembur", 80,
HorizontalAlignment.Center)
ListView1.Columns.Add("Pajak", 80, HorizontalAlignment.Center)
ListView1.Columns.Add("Total", 80, HorizontalAlignment.Center)
ListView1.View = View.Details
ListView1.GridLines = True
ListView1.FullRowSelect = True
End Sub
Sub
IsiTabel()
Dim Lst
As New
ListViewItem
Lst.Text = NIK.Text
Lst.SubItems.Add(Nama.Text)
Lst.SubItems.Add(Jabatan.Text)
Lst.SubItems.Add(Gaji.Text)
Lst.SubItems.Add(Status.Text)
Lst.SubItems.Add(Tunjistri.Text)
Lst.SubItems.Add(JAnak.Text)
Lst.SubItems.Add(TunjAnak.Text)
Lst.SubItems.Add(Jlembur.Text)
Lst.SubItems.Add(Honor.Text)
Lst.SubItems.Add(Pajak.Text)
Lst.SubItems.Add(Total.Text)
ListView1.Items.Add(Lst)
End Sub
Private Sub cmdBaru_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles cmdBaru.Click
NIK.Text = ""
Nama.Text = ""
Status.Text = ""
Jabatan.Text = ""
Pajak.Text = ""
Total.Text = ""
Gaji.Text = ""
Tunjistri.Text = ""
TunjAnak.Text = ""
JAnak.Text = ""
Honor.Text = ""
Jlembur.Text = ""
TunjAnak.Text = ""
End Sub
Private Sub cmdKeluar_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles cmdKeluar.Click
Me.Close()
End Sub
Private Sub cmdProses_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles cmdProses.Click
Total.Text = Val(Honor.Text) +
Val(Gaji.Text) + Val(Tunjistri.Text) + Val(Tunjistri.Text) - Val(Pajak.Text)
End Sub
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
NIK.Items.Add("001")
NIK.Items.Add("002")
NIK.Items.Add("003")
Jabatan.Items.Add("Mandor")
Jabatan.Items.Add("Kepala Bagian")
Jabatan.Items.Add("Staff")
Status.Items.Add("Menikah")
Status.Items.Add("Tidak Menikah")
For i =
1 To 4
JAnak.Items.Add(i)
Next i
For i =
1 To 10
Jlembur.Items.Add(i)
Next i
BuatTabel()
End Sub
Private Sub Jabatan_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
Jabatan.SelectedIndexChanged
Select Case Jabatan.Text
Case
"Mandor" : Gaji.Text = 1750000
Case
"Kepala Bagian" : Gaji.Text =
2500000
Case
"Staff" : Gaji.Text = 1250000
End Select
Pajak.Text = 0.015 * Gaji.Text
End Sub
Private Sub JAnak_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
JAnak.SelectedIndexChanged
If
JAnak.Text >= 2 And Status.Text = "Menikah" Then
TunjAnak.Text = 0.07 * Gaji.Text
ElseIf
JAnak.Text = 1 And Status.Text = "Tidak Menikah" Then
TunjAnak.Text = 0.03 * Gaji.Text
Else
TunjAnak.Text = 0
End If
End Sub
Private Sub Jlembur_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
Jlembur.SelectedIndexChanged
If
Jabatan.Text = "Mandor" Then
Honor.Text = 7500 * Jlembur.Text
ElseIf
Jabatan.Text = "Kepala Bagian" Then
Honor.Text = 10000 * Jlembur.Text
ElseIf
Jabatan.Text = "Staff" Then
Honor.Text = 5000 * Jlembur.Text
Else
Honor.Text = 0
End If
End Sub
Private Sub NIK_SelectedIndexChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
NIK.SelectedIndexChanged
Select Case NIK.Text
Case
"001" : Nama.Text = "Jhon Carlos"
Case
"002" : Nama.Text = "Arafat"
Case
"003" : Nama.Text = "Haris Lesmana"
End Select
End Sub
Private Sub Status_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
Status.SelectedIndexChanged
Select Case Status.Text
Case
"Menikah" : Tunjistri.Text = 0.09
* Gaji.Text
Case
"Tidak Menikah" : Tunjistri.Text =
0
End Select
End Sub
Private Sub cmdSimpan_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles cmdSimpan.Click
IsiTabel()
NIK.Text = ""
Nama.Text = ""
Jabatan.Text = ""
Gaji.Text = ""
Status.Text = ""
Tunjistri.Text = ""
JAnak.Text = ""
TunjAnak.Text = ""
Jlembur.Text = ""
Honor.Text = ""
Pajak.Text = ""
Total.Text = ""
End Sub
End Class
Lalu Simpan Ke ListView ……