Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Array of Collections

I'm trying to creat an array of collection without success.

I have a Class called "MyClass"
In the control module I use the following commands:
Dim myCollections() as Collection

Redim myCollections(7) 'assume I have 7 collections to populate

As I loop through the data rows, I populate the class "MyClass"
and them based on the content of a field(0-6), add it to the appropriate
collection(i).

'here's how I add the class to the collection
Call myCollection(i).add(Item:=myClass)

For the first data row (i=0), the myCollection(0).item(1) is correct

My problen is when the second data row is read with a different index (i=1)
I end up with myCollection(0).item(1) being updated as myCollection(1).add is
executed.

Why would myCollection(0) be changed when I add to myCollection(1)?

Thanks,
- Pat




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default Array of Collections

I'm trying to creat an array of collection without success.

I have a Class called "MyClass"
In the control module I use the following commands:
Dim myCollections() as Collection

Redim myCollections(7) 'assume I have 7 collections to populate


Redim myCollections(1 to 7)


As I loop through the data rows, I populate the class "MyClass"
and them based on the content of a field(0-6), add it to the appropriate
collection(i).

'here's how I add the class to the collection
Call myCollection(i).add(Item:=myClass)

For the first data row (i=0), the myCollection(0).item(1) is correct

My problen is when the second data row is read with a different index
(i=1)
I end up with myCollection(0).item(1) being updated as myCollection(1).add
is
executed.

Why would myCollection(0) be changed when I add to myCollection(1)?


Watch for typos - is it myCollection or myCollections?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
A List of Collections and Custom Collections ExcelMonkey Excel Programming 1 December 20th 07 10:04 PM
For Each and Collections Memento Excel Programming 6 June 4th 07 02:57 PM
Collections of Collections David Morton Excel Programming 6 November 13th 04 01:10 AM
Help with collections ksnapp[_45_] Excel Programming 1 April 7th 04 12:42 AM
Using Collections Kerry[_4_] Excel Programming 1 January 25th 04 04:08 PM


All times are GMT +1. The time now is 05:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"