vb.net listview selected items (WM6) RRS feed

  • Question

  • in vb.net i have a listview set to list as viewtype. I have enabled checkboxes for the items in that listbox.
    How can i get the index of all selected items??
    Wednesday, March 25, 2009 12:23 AM


  • Hi,

    You could use the following code snippet to get the checked items from a listview control :-

    ListView.ListViewItemCollection lvic = this.listView1.Items;  
    List<ListViewItem> checkedItems = new List<ListViewItem>();  
    foreach (ListViewItem lvi in lvic)  
        if (lvi.Checked)  

    Dim lvic As ListView.ListViewItemCollection = Me.listView1.Items   
    Dim checkedItems As New List(Of ListViewItem)()   
    For Each lvi As ListViewItem In lvic   
        If lvi.Checked Then   
        End If   

    Hope this helps.

    Paul Diston
    • Marked as answer by eagle00789 Wednesday, March 25, 2009 3:50 PM
    Wednesday, March 25, 2009 8:15 AM