Home » » Membuat ListView pada Visual Studio 2008

Membuat ListView pada Visual Studio 2008

Design form seperti dibawahgambar dibawah ini

No
Komponen
Properties
Value
1
Label1
name
npm




2
Label2
name
nama
3
button1
name
simpan


tekssimpan
4button2name
 teks
hapus
hapus

button3name
teks
hapuspilih
hapuspilih
5
listview
name
LV














lalu ketikan perintah sesuai perintah dibawah ini

Public Class Form1

    Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LV.SelectedIndexChanged

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        buatTable()
    End Sub
    Sub buatTable()
        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 IsiTable()
        Dim Lst As New ListViewItem
        Lst.Text = NPM.Text

        Lst.SubItems.Add(NAMA.Text)
        Lv.Items.add(Lst)
    End Sub

    Private Sub BTNSIMPAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNSIMPAN.Click
        IsiTable()
        NPM.Text = ""
        NAMA.Text = ""

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNHAPUS.Click
        LV.Items.Clear()
    End Sub

    Private Sub BTNDATA_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNDATA.Click
        LV.Items.Remove(LV.SelectedItems(0))
    End Sub
End Class

http:/trianiarista.blogspot.com
http:/mesran.net

Written by : Your Name - Describe about you

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam id libero non erat fermentum varius eget at elit. Suspendisse vel mattis diam. Ut sed dui in lectus hendrerit interdum nec ac neque. Praesent a metus eget augue lacinia accumsan ullamcorper sit amet tellus.

Join Me On: Facebook | Twitter | Google Plus :: Thank you for visiting ! ::

0 komentar:

Posting Komentar