Click to See Complete Forum and Search --> : ListView bug


February 22nd, 2000, 09:42 AM
Hello,

I have used the following code to remove item (file name) from listview control:

For i = 0 To List1.ListCount - 1
If List1.Selected(i) Then
List1.RemoveItem i
List1.Refresh
End If
Next i

And I have meet the following error:

1) if i select the first item in the list to delet it, I got this errow code: *381* Invalide property array index.

2) if i select the middle item in the list, Nothing happen

3)But if i *first* select the last item in the list then delet it, It works fine.. and then i can delete all items no matter the order i select.

I have a hard time to figure the cause. But want it work nomatter the order user selects. Please help! Thanks!

Crazy D
February 22nd, 2000, 09:57 AM
Nope not a bug...
I don't know though, but change your loop to walk back, for i = listcount - 1 to 0 step -1, that should help (I hope...)

Crazy D :-)
"One ring rules them all"