[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

Accessing VB6 associative array from C#

Mr. Land

11/7/2007 5:38:00 PM

I have a legacy VB6 DLL that I'm calling from a C# program. I'm using
the "Add Reference" functionality in VS 2005 to accomplish this.

One of the classes that are implemented in the DLL has a member which
is an associative array (indexed by strings.)

If I call into the DLL from VB.NET, I can use the following syntax and
it works just fine:

myElement = DLLObject.elements("Mine")

....but I can't figure out how to do this from C#. So far I've tried
the following:

myElement = DLLObject.elements["Mine"];

string strIndex = "Mine";
myElement = DLLObject.elements[strIndex];

string strIndex = "Mine";
myElement = DLLObject.elements[ref strIndex];

When I look at the referenced DLL within Visual Studio, about the
closest thing I can find to what I'm looking for is a method:
DLLObject.get_Item(ref Object); - but I'm not sure if this is what I
need to use.

I also see a GetEnumerator() method along with an Add(), but that's
about it.

Is it possible to do this? If so, what would it look like?

Thank you.