For/Each "empty Placeholder" at zero index

  • Thread starter Thread starter Thomas Malia
  • Start date Start date
T

Thomas Malia

I'm converting a VB6 program that used collection.

When I add items to the collections, the collection is putting a placeholder
item in the zero index position. This seems to break my code when I try to
execute "For/Each" opperations on the collection.

I can't find a way to force the system to use the zero index when I add
items and I don't know how to tell "For/Each" to ignore the first element.
I can change my loop logic to use an integer index from 1 to the Count of
the collection, but that's so much messier than just using the "For/Each"
syntax.

What am I doing wrong? How can I get my "For/Each" to work?
 
Never mind.

The the upgrade utility replace my VB6 "getenumerator" code with the correct
code for .net but left it commented out. All I had to do was follow the
upgrade comment instructions and uncomment the line and things worked.
 
Thomas said:
When I add items to the collections, the collection is putting a
placeholder item in the zero index position. This seems to break my
code when I try to execute "For/Each" opperations on the collection.

I can't find a way to force the system to use the zero index when I
add items

Show us how the code where you add the items, as that appears to be where
it's going wrong.

Andrew
 
Back
Top