Jumat, 27 Januari 2012

jawaban soal 2 (nina serly)

listimg program


Public Class Form1
    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 Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        BuatTable()
    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 btnHapusAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHapusAll.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




Tidak ada komentar:

Posting Komentar