ChEMunguth

ChEMunguth

Jumat, 21 Desember 2012

CONTOH PROGRAM LIST VIEW


CONTOH PROGRAM LIST VIEW


PublicClass Form1

PrivateSub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
        NIP.Items.Add("123002")
        NIP.Items.Add("123003")
        NIP.Items.Add("123004")
        NIP.Items.Add("123005")
        NIP.Items.Add("123006")
        NIP.Items.Add("123007")
        NIP.Items.Add("123008")
        GOL.Items.Add("IA")
        GOL.Items.Add("IIA")
        GOL.Items.Add("IIIA")
Call BUAT_TABEL()
EndSub
Sub BUAT_TABEL()
        LV.GridLines = True
        LV.View = View.Details
        LV.FullRowSelect = True
        LV.Columns.Add("NIP")
        LV.Columns.Add("NAMA")
        LV.Columns.Add("GOL")
        LV.Columns.Add("GAJI")


EndSub

PrivateSub LV_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LV.SelectedIndexChanged


EndSub

PrivateSub BTNMASUK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNMASUK.Click
Dim LST AsNew ListViewItem
        LST.Text = NIP.Text
        LST.SubItems.Add(NAMA.Text)
        LST.SubItems.Add(GOL.Text)
        LST.SubItems.Add(GAJI.Text)
        LV.Items.Add(LST)
EndSub

PrivateSub BTNHAPUSLIST_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNHAPUSLIST.Click
        LV.Items.Clear()
EndSub

PrivateSub NIP_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NIP.SelectedIndexChanged
If NIP.Text = 123002 Then
            NAMA.Text = "ADI"
ElseIf NIP.Text = 123003 Then
            NAMA.Text = "EKO"
ElseIf NIP.Text = 123004 Then
            NAMA.Text = "DIANA"
ElseIf NIP.Text = 123005 Then
            NAMA.Text = "FEBRYDONI"
ElseIf NIP.Text = 123006 Then
            NAMA.Text = "GITA"
ElseIf NIP.Text = 123007 Then
            NAMA.Text = "HENDRI"
ElseIf NIP.Text = 123008 Then
            NAMA.Text = "IRPAN"
EndIf
EndSub

PrivateSub BTNKELUAR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNKELUAR.Click
End
EndSub

PrivateSub BTNHAPUSISIAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNHAPUSISIAN.Click
        LV.Items.Remove(LV.SelectedItems(0))
EndSub
EndClass

Tidak ada komentar:

Posting Komentar