Hi, i am using VB6 and in my project using List View Control. The checkboxes property is setted true. Now i want to implement a functionality so that to remove only those entries/items cheked by user from the list. Can anybody tell me how to implement this. ANY CODE
Since After Removing Selected Items, ListItems.Count Keeps on Decreasing, so u have to reverse ur "For Loop " condition.
Check this Code:
For nI = lvBooks.ListItems.Count To 1 Step -1
If lvBooks.ListItems.Item(nI).Checked = True Then
lvBooks.ListItems.Remove (nI)
End If
If lvBooks.ListItems.Count=0 Then Exit For
Next nI
Hi, last year i asked this question and answered well. No i am in the same situation in VB.NET. What is to do same thing means removing checked items from list view in VB.NET
Hi, i am using VB6 and in my project using List View Control. The checkboxes property is setted true. Now i want to implement a functionality so that to remove only those entries/items cheked by user from the list. Can anybody tell me how to implement this. ANY CODE[/QUOTE]
Dim lvi As ListItem
Dim i As Integer
Dim count As Integer
count = ListView1.ListItems.count
For i = 1 To count
If i > count Then Exit For
Set lvi = ListView1.ListItems(i)
If lvi.Checked = True Then
ListView1.ListItems.Remove (lvi.Index)
i = i - 1
count = count - 1
End If
Next
We appreciate your help. Have you ever noticed that the current thread is two years old? Please do not resurrect old threads and have a look at forum rules . Please read before posting - http://www.daniweb.com/forums/thread78223.html