Sign in to follow this  
owl

returning a byte() array from Visual Basic 6 to .NET from an ActiveX DLL Method

Recommended Posts

owl    376
Hi!

I'm having problems with this, I need to cast an array of bytes from a VB6 ActiveX DLL reference method in a C# winform project.

the vb6 DLL would contain a method like


public function getArray() as byte()
dim arr
redim arr(0 to 100)
getArray = arr
end fuction


and then in .NET


myVBClass C = new myVBClass();

byte[] arr = (byte[])myVBClass.getArray();


But of course this isn't working.

How can I achieve this? Is it even possible? Should be done with strings?

Thanks in advance!

Share this post


Link to post
Share on other sites
owl    376
I found a way:



Object[] myObj = myComClass.getArray();

for (int i=0; i < myObj.Lenght; i++)
{
Byte MyByte = Convert.ToByte(myObj[i]);
}


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this