VBA.Collection in C#

  • Thread starter Thread starter Ariel Gimenez
  • Start date Start date
A

Ariel Gimenez

Hi, im using a vb dll in my project and i need to access one object within
it of type VBA.Collection, somebody can give me a hand to do this? i tried
to cast to an array, object[] etc. but seems im in the wrong way...

Thanks In Advance
Ariel Gimenez
 
Ariel,

If you are using a VB.NET dll, then you can set a reference to
Microsoft.VisualBasic.dll and use the Collection class that is in that
assembly in the same manner as you would in VB. If this is the case, then
you probably should change the code so that it uses an ArrayList, or a
Hashtable (depending on whether or not you use the keys in the Collection).

If this is a Collection from a VB6 dll used in COM interop, then you
will have to take the collection and manually populate an ArrayList or a
Hashtable yourself, depending on your needs.

Hope this helps.
 
Thanks Nicholas!!!!

Nicholas Paldino said:
Ariel,

If you are using a VB.NET dll, then you can set a reference to
Microsoft.VisualBasic.dll and use the Collection class that is in that
assembly in the same manner as you would in VB. If this is the case, then
you probably should change the code so that it uses an ArrayList, or a
Hashtable (depending on whether or not you use the keys in the Collection).

If this is a Collection from a VB6 dll used in COM interop, then you
will have to take the collection and manually populate an ArrayList or a
Hashtable yourself, depending on your needs.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Ariel Gimenez said:
Hi, im using a vb dll in my project and i need to access one object within
it of type VBA.Collection, somebody can give me a hand to do this? i tried
to cast to an array, object[] etc. but seems im in the wrong way...

Thanks In Advance
Ariel Gimenez
 
Back
Top