NV2002
March 2nd, 2003, 06:49 AM
Hi All ,
I have written a Subroutine to DELETE all of the checked Items in a ListView fixed in 'Details' Mode and has Checkboxes at all items.
' Routine to Remove Checked Items in a ListView
' Example Usage : RemoveCheckedItemsLV(Listview1)
Public Sub RemoveCheckedItemsLV(ByRef LV As ListView)
LV.BeginUpdate() ' Turn off the ListView
Do Until LV.CheckedIndices.Count = 0
Dim i As Integer
For i = 0 To LV.Items.Count - 1
If LV.Items(i).Checked = True Then
LV.Items.RemoveAt(i)
Exit For ' Fresh Start the Loop again INDEX CHANGED
End If
Next
Loop
LV.EndUpdate() ' Turn on the Listview
End Sub
When I have Hundreds of Items it seems too slow. Is there another way to delete Checked Items that is quicker.
Nick
I have written a Subroutine to DELETE all of the checked Items in a ListView fixed in 'Details' Mode and has Checkboxes at all items.
' Routine to Remove Checked Items in a ListView
' Example Usage : RemoveCheckedItemsLV(Listview1)
Public Sub RemoveCheckedItemsLV(ByRef LV As ListView)
LV.BeginUpdate() ' Turn off the ListView
Do Until LV.CheckedIndices.Count = 0
Dim i As Integer
For i = 0 To LV.Items.Count - 1
If LV.Items(i).Checked = True Then
LV.Items.RemoveAt(i)
Exit For ' Fresh Start the Loop again INDEX CHANGED
End If
Next
Loop
LV.EndUpdate() ' Turn on the Listview
End Sub
When I have Hundreds of Items it seems too slow. Is there another way to delete Checked Items that is quicker.
Nick