By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,290 Members | 1,427 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,290 IT Pros & Developers. It's quick & easy.

Reading a VB6 Collection object?

P: n/a
I'm working on a project that uses some older VB6 COM objects. One of
the classes returns a Collection object, which I am having trouble
reading in C#. Can someone point me in the right direction here...

ComObject objItemType = new ComObject("Items");
args = new object[0];
VBA.Collection coll = objItemType.doMethod("GetTypes",args); // This
method is returning a collection

Now, I know the method call is working OK and actually returning data,
because the Count property of coll is set correctly. But I cannot get
at the individual items, which in this case is another VB6 COM object.
Everything I've tried (foreach, indexer, etc.) either fails at compile
or run time.

What is the correct way to access these objects in the collection???
Is VBA.Collection not the correct object? Do I need to cast it to
something else? This is driving me crazy.

Oct 20 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.