Results 1 to 10 of 10

Thread: myCollection.Remove problem [Resolved]

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2001
    Posts
    378

    myCollection.Remove problem [Resolved]

    This won't work:
    VB Code:
    1. Public Sub ClearCollection(myCollection As Collection)
    2.  
    3.     For i = 1 To myCollection.Count
    4.    
    5.         myCollection.Remove (i)
    6.         Debug.Print i & " - " & myCollection(i).sFileName
    7.  
    8.     Next
    9.    
    10. End Sub

    I'm getting a "subscript out of range" error


    It is really strange. If i don't commment out the remove command and just print out the values, then it works fine. Does removing the items somehow mess up the index?

    I'm really just trying to clear all the values out of the collection.

    thanks
    Last edited by Kira Roark; Jun 4th, 2004 at 01:11 PM.

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