Adding objects to collections 
Author Message
 Adding objects to collections

I am trying to add a 'large' amount of objects to a collection.
It seems that it is not possible to add more then 256 objects
to a collection.
Adding more objects in code, does not add the object to
the collection and does not generate a runtime error.
Is this a VB5 bug or is there a limit on the number of objects
you can add to a collection ?

This is some sample code:

dim objTest as object
dim colTest as new collection

for counter=1 to 10000
    set objTest = new object
    'set object data
    colTest.add objTest
next

If you I look in the watch window, I see that only
256 of the 10000 objects are added }:-|

Please help !

Koen



Sat, 29 Sep 2001 03:00:00 GMT  
 Adding objects to collections
The problem is not with the Collection class, it is with the debug watch
window, which only shows you the first 256 objects in the collection.

Put a

Debug.Print colTest.Count

statement after your loop - you have ten thousand objects.

Quote:

>for counter=1 to 10000
>    set objTest = new object
>    colTest.add objTest
>next

>If you I look in the watch window, I see that only
>256 of the 10000 objects are added }:-|

>Please help !

>Koen



Sun, 30 Sep 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. VB5.0 Type mismatch when adding object to collection

2. Adding Objects to Collections

3. ? Collection add object -> usercontrol add control

4. ? Collection add object -> usercontrol add control

5. Adding objects to a collection object

6. Adding to Collection Object

7. How do you add object to a collection

8. More on Adding a class object to collections

9. Adding user defined types to a collection object

10. Storing objects added to a collection in a database

11. Adding User-Defined Type to a Collection Object

12. Collection.Add and Collection.Item question?

 

 
Powered by phpBB® Forum Software