Deleting all items from a listview? 
Author Message
 Deleting all items from a listview?

Hi,
    thanks for your help. I need to delete all items from a listview. I did
this code and there's always some items left. What's wrong?

For j = 1 To lstVresults.ListItems.Count
            lstVresults.ListItems.Remove (j)
            lstVresults.ListItems.Item(j).ListSubItems.Remove (j)
Next j

--

www.illusion.qc.ca



Fri, 07 Dec 2001 03:00:00 GMT  
 Deleting all items from a listview?


Quote:
> Hi,
>     thanks for your help. I need to delete all items from a listview. I did
> this code and there's always some items left. What's wrong?

> For j = 1 To lstVresults.ListItems.Count
>             lstVresults.ListItems.Remove (j)
>             lstVresults.ListItems.Item(j).ListSubItems.Remove (j)
> Next j

> --

> www.illusion.qc.ca

Try using lstVresult.ListItems.Clear

The Clear method should remove all the objects in the collection

gene



Fri, 07 Dec 2001 03:00:00 GMT  
 Deleting all items from a listview?
Use
For j = lstVresults.ListItems.Count - 1 to 0

Starting at the bottom and work up. Or you can just delete the first one
until count = 0

But isn't there a clear method?

Quote:

>Hi,
>    thanks for your help. I need to delete all items from a listview. I did
>this code and there's always some items left. What's wrong?



Sat, 08 Dec 2001 03:00:00 GMT  
 Deleting all items from a listview?
Yeah, there is one but i was too blind to see it. Thanks anyways!


Quote:
> Use
> For j = lstVresults.ListItems.Count - 1 to 0

> Starting at the bottom and work up. Or you can just delete the first one
> until count = 0

> But isn't there a clear method?


> >Hi,
> >    thanks for your help. I need to delete all items from a listview. I
did
> >this code and there's always some items left. What's wrong?



Sat, 08 Dec 2001 03:00:00 GMT  
 Deleting all items from a listview?

You might want to try counting backwards so that you start from the top
of the
array and work yourself back down to 0 using Step -1

Ryan Bae
ESRI Technical Support

www.esri.com

Quote:

> Hi,
>     thanks for your help. I need to delete all items from a listview. I did
> this code and there's always some items left. What's wrong?

> For j = 1 To lstVresults.ListItems.Count
>             lstVresults.ListItems.Remove (j)
>             lstVresults.ListItems.Item(j).ListSubItems.Remove (j)
> Next j

> --

> www.illusion.qc.ca



Sat, 08 Dec 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Repost: Deleting last listview item

2. Delete last Listview Item

3. How to iterate through and delete mutiple selected items from a listview

4. Delete Listview Item

5. Deleting ListView items

6. ListView.EnsureVisible near deleted item

7. listview delete items?

8. Deleting ListView items

9. Delete multiple listview items?

10. Quick Redraw a ListView After deleting Item(s)

11. Delete item in listview

12. Quick Redraw a ListView After deleting Item(s)

 

 
Powered by phpBB® Forum Software