3
votes

How to consume a VB6 DLL from .net?

The dll has a method called rfc that returns an array, and has a parameter that is a vector of integers. How to make the call to this dll?

Please give examples.

var cls = new MyDllVB6.MyClassInVB6();
/*?Array?*/ = cls.MyFunctionInClass( /*?Vector of integer?*/);
2

2 Answers

4
votes

VB6 dlls are normal COM dlls, so just adding it to the project references should suffice, the .NET COM interop will do the rest for you.

2
votes
int[] vectorOfIntegers = new int[5];
vectorOfIntegers[0] = 123;
vectorOfIntegers[1] = 456;
.
:
int[] outputArray = cls.MyFunctionInClass(vectorOfIntegers);