Berikut merupakan tugas pemrograman visual yang diberikan Pak Mesran, tentang listview ,
Public Class Form1
Sub
BUATTABLE()
LV.Columns.Add("NIK",
80, HorizontalAlignment.Center)
LV.Columns.Add("NAMA",
100, HorizontalAlignment.Left)
LV.Columns.Add("JABATAN",
60, HorizontalAlignment.Left)
LV.Columns.Add("GAJI",
60, HorizontalAlignment.Left)
LV.Columns.Add("STATUS",
60, HorizontalAlignment.Left)
LV.Columns.Add("TJN
KELUARGA", 60, HorizontalAlignment.Left)
LV.Columns.Add("PAJAK",
60, HorizontalAlignment.Left)
LV.Columns.Add("TOTAL
GAJI", 80, HorizontalAlignment.Left)
LV.View = View.Details
LV.GridLines = True
LV.FullRowSelect = True
End Sub
Sub
ISITABLE()
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(TUNJ.Text)
LST.SubItems.Add(PAJAK.Text)
LST.SubItems.Add(TTL_GAJI.Text)
LV.Items.Add(LST)
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("STAF")
STATUS.Items.Add("Menikah")
STATUS.Items.Add("Belum Menikah")
BUATTABLE()
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 = "Laila Nurli"
Case
"002" : NAMA.Text = "Ema Satriana"
Case
"003" : NAMA.Text = "Sri Wahyuningsih"
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" : TUNJ.Text = 0.15 *
GAJI.Text
Case
"Belum Menikah" : TUNJ.Text = 0
End Select
End Sub
Private Sub BTNPROSES_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BTNPROSES.Click
TTL_GAJI.Text = Val(GAJI.Text) +
Val(TUNJ.Text) - Val(PAJAK.Text)
ISITABLE()
NIK.Text = ""
NAMA.Text = ""
JABATAN.Text = ""
GAJI.Text = ""
STATUS.Text = ""
TUNJ.Text = ""
PAJAK.Text = ""
TTL_GAJI.Text = ""
End Sub
Private Sub BTNKELUAR_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BTNKELUAR.Click
Close()
End Sub
End Class
Hasil :
LISTVIEW II :
Public Class Form1
Sub
buattabel()
lv.Columns.Add("NPM",
80, HorizontalAlignment.Center)
lv.Columns.Add("Nama",
180, HorizontalAlignment.Left)
lv.View = View.Details
lv.GridLines = True
lv.FullRowSelect = True
End Sub
Sub
isitabel()
Dim lst
As New
ListViewItem
lst.Text = npm.Text
lst.SubItems.Add(nama.Text)
lv.Items.Add(lst)
End Sub
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
buattabel()
End Sub
Private Sub Btnsimpan_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Btnsimpan.Click
isitabel()
npm.Text = ""
nama.Text = ""
End Sub
End Class
Hasil :
LISTVIEW III :
Public Class Form2
Sub
buattabel()
lv.Columns.Add("NPM",
80, HorizontalAlignment.Center)
lv.Columns.Add("Nama",
180, HorizontalAlignment.Left)
lv.View = View.Details
lv.GridLines = True
lv.FullRowSelect = True
End Sub
Sub
isitabel()
Dim lst
As New
ListViewItem
lst.Text = npm.Text
lst.SubItems.Add(nama.Text)
lv.Items.Add(lst)
End Sub
Private Sub Form2_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
buattabel()
End Sub
Private Sub Btnsimpan_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Btnsimpan.Click
isitabel()
npm.Text = ""
nama.Text = ""
End Sub
Private Sub Btnhapussemua_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Btnhapussemua.Click
lv.Items.Clear()
End Sub
Private Sub Btnhapus_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Btnhapus.Click
lv.Items.Remove(lv.SelectedItems(0))
End Sub
End Class
Hasil :
28 May 2013 at 08:36
ke link http://www.mesran.blogspot.com/2013/05/tugas-ti-p1104.html seharusnya di link kan