Design Daftar Gaji Dengan Menggunakan Listview Pada Pemrograman Visual Basic.Net
Listing Programnya :
Public Class Form1
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("staf")
status.Items.Add("menikah")
status.Items.Add("tidak
menikah")
buattabel()
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(tunjkeluarga.Text)
lst.SubItems.Add(pajak.Text)
lst.SubItems.Add(Total.Text)
Lv.Items.Add(lst)
End Sub
Sub buattabel()
Lv.Columns.Add("Nik",
50, HorizontalAlignment.Left)
Lv.Columns.Add("Nama",
70, HorizontalAlignment.Left)
Lv.Columns.Add("Jabatan",
90, HorizontalAlignment.Left)
Lv.Columns.Add("Gaji",
60, HorizontalAlignment.Left)
Lv.Columns.Add("Status",
90, HorizontalAlignment.Center)
Lv.Columns.Add("Tunjangan
keluarga", 130, HorizontalAlignment.Left)
Lv.Columns.Add("Pajak",
60, HorizontalAlignment.Left)
Lv.Columns.Add("Total
Gaji", 90, HorizontalAlignment.Left)
lv.View = View.Details
lv.GridLines = True
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 "staf" :
gaji.Text = 1250000
End Select
pajak.Text = 0.15 *
gaji.Text
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 = "oncom"
Case "002" :
nama.Text = "udin"
Case "003" :
nama.Text = "ujang"
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"
: tunjkeluarga.Text = 0.15 * gaji.Text
Case "tidak
menikah" : tunjkeluarga.Text = 0
End Select
End Sub
Private Sub BtnSimpan_Click(ByVal
sender As System.Object, ByVal e As System.EventArgs) Handles BtnSimpan.Click
isitabel()
Nik.Text = ""
nama.Text = ""
jabatan.Text = ""
gaji.Text = ""
status.Text = ""
tunjkeluarga.Text = ""
pajak.Text = ""
Total.Text = ""
End Sub
Private Sub BtnProses_Click(ByVal
sender As System.Object, ByVal e As System.EventArgs) Handles BtnProses.Click
Total.Text = Val(gaji.Text)
+ Val(tunjkeluarga.Text) - Val(pajak.Text)
End Sub
Private Sub BtnHapus_Click(ByVal
sender As System.Object, ByVal e As System.EventArgs) Handles BtnHapus.Click
Lv.Items.Clear()
End Sub
Private Sub
BtnDataDiPilih_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles BtnDataDiPilih.Click
Lv.Items.Remove(Lv.SelectedItems(0))
End Sub
Private Sub BtnKeluar_Click(ByVal
sender As System.Object, ByVal e As System.EventArgs) Handles BtnKeluar.Click
End
End Sub
Private Sub BtnBersih_Click(ByVal
sender As System.Object, ByVal e As System.EventArgs) Handles BtnBersih.Click
Nik.Text = ""
nama.Text = ""
jabatan.Text = ""
gaji.Text = ""
status.Text = ""
tunjkeluarga.Text = ""
Total.Text = ""
pajak.Text = ""
End Sub
End Class
Form Gaji Saat Di Input Data
Berikut Hasil Program Daftar Gaji Dengan Menggunakan Listview Pada Pemrograman Visual Basic.Net
Tugas Pemrograman Visual Basic.Net, Silakan Klik Di Sini
Tidak ada komentar