Untuk para pengguna Visual Basic.Net 2010 kali ini saya akan memberikan Tutorial Visual Basic 2010 yang membahas tentang cara menggunakan ListView tools. bagaimana cara menambah, mengedit ataupun menghapus item yang ada di dalamnya. semoga bermanfaat
Source Code :
Public Class FrmListView Dim Baris As Integer = 0 Dim BarisEdit As Integer = 0 Private Sub FrmListView_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Mengatur ListView ListView1.View = View.Details ListView1.FullRowSelect = True ListView1.GridLines = True ListView1.Columns.Add("Nama Lengkap", 150) ListView1.Columns.Add("Alamat", 200) End Sub Private Sub BtnTambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnTambah.Click ListView1.Items.Add(TextBox1.Text) ListView1.Items(Baris).SubItems.Add(TextBox2.Text) Baris += 1 End Sub Private Sub BtnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnEdit.Click ListView1.Items(BarisEdit).Text = TextBox1.Text ListView1.Items(BarisEdit).SubItems(1).Text = TextBox2.Text End Sub Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged) BarisEdit = ListView1.FocusedItem.Index End Sub Private Sub BtnHapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnHapus.Click ListView1.Items(BarisEdit).Remove() End Sub End ClassBy Franky So
1 komentar:
thx gan info'y.. ^^
Posting Komentar
Komentar anda akan di tampilan setelah disetujui oleh moderator.