Clearing a collection...

  • Thread starter Thread starter Brad Pears
  • Start date Start date
B

Brad Pears

I am using a collection (in place of an array) to house some temporary
items...

Is there a way to easily remove ALL items from a collection? The way I read
it, you have to loop through all collection items and use the .remove method
to remove each item individually. As well, you need to specify the key...

What if you do not know what the friggin key is for pete's sakes (unless you
used an incremental counter when loading the items) and you just want to
clear the thing?

Thanks,

Brad
 
Brendan and Graham are right, of course; but you can access items in a
collection using the numerical index as well as whatever keys you
assigned, e.g.

For j = Col.Count To 1 Step -1
Col.Remove j
Next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top