hashTable.RemoveAll

  • Thread starter Thread starter msnews.microsoft.com
  • Start date Start date
M

msnews.microsoft.com

So what is the best way to iterate through the hash table to remove all the
members?

i tried using the enumerator but it gets an exception as it removes each
element.

dim de as dictionaryEntry
for each de in xHashTable
xHashTable.remove(de.key)
next

I am missing the vb6 scripting.dictionary.removeall.

Thanks,
jeff
 
Isn't there a clear() method? xHashTable.clear

There is no real need to remove as you go through and process each.
 
* "msnews.microsoft.com said:
So what is the best way to iterate through the hash table to remove all the
members?

Call the hashtable's 'Clear' method. You cannot manipulate the
hashtable when enumerating it with 'For...Each'.
 
Back
Top