|
-
Dec 17th, 2003, 11:39 AM
#1
Thread Starter
Addicted Member
Multi-item delete [RESOLVED]
What is the best way to delete multiple items from a listview?
Last edited by GSIV; Dec 17th, 2003 at 06:59 PM.
-
Dec 17th, 2003, 12:29 PM
#2
Frenzied Member
to remove the selected items you can do something like this
VB Code:
Dim item As ListViewItem
For Each item In ListView1.Items
If (item.Selected) Then
ListView1.Items.Remove(item)
End If
Next
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Dec 17th, 2003, 03:55 PM
#3
yay gay
I don't think that would work, because if you delete item 0 then the item 1 will became it 0 and so on, so the thing is : you must start deleting from the last item to the 1st one so this kind of error doesn't happen
\m/  \m/
-
Dec 17th, 2003, 05:03 PM
#4
Frenzied Member
actually it works just fine. Because it is only removing the selected items...so if you select all the items...it just removes all the items.
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Dec 17th, 2003, 05:08 PM
#5
yay gay
Lookin carefully at the code i think it is working because it is a for...each statement.
Try doing it with a for() loop and it will pomp out an error
\m/  \m/
-
Dec 17th, 2003, 06:59 PM
#6
Thread Starter
Addicted Member
Thanks guys... this works good.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|