CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: ListView bug

  1. #1
    Guest

    ListView bug

    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!




  2. #2
    Join Date
    Apr 1999
    Location
    Rotterdam, Netherlands
    Posts
    278

    Re: ListView bug

    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"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured