For/Each "empty Placeholder" at zero index

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?
 
T

Thomas Malia

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.
 
A

Andrew Morton

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
 

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

Top