Powered By Blogger

Kamis, 31 Maret 2011

materi 3


Public Class Form2
Dim listtxt(3) As String
Dim listitems As ListViewItem

Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call setlistview()
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
listtxt(0) = Trim(TextBox1.Text)
listtxt(1) = Trim(TextBox2.Text)
listtxt(2) = Trim(TextBox3.Text)

listitems = New ListViewItem(listtxt)
ListView1.Items.Add(listitems)
End Sub
Sub setlistview()
ListView1.View = View.Details

ListView1.Columns.Add("NPM", 100, HorizontalAlignment.Center)
ListView1.Columns.Add("Nama", 100, HorizontalAlignment.Left)
ListView1.Columns.Add("Alamat", 300, HorizontalAlignment.Left)
End Sub

Private Sub ListView1_ItemSelectionChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.ListViewItemSelectionChangedEventArgs) Handles ListView1.ItemSelectionChanged
TextBox4.Text = e.Item.Text
End Sub

End Class

Tidak ada komentar:

Posting Komentar