Passing Object Array back to Variant array.

B

buzzluck68

Hello,

I am having trouble upgrading my VB apps to .net. When i started at
my company there was a dll created here in vb6, and i need to use that
dll for many functions that would take too much time to re-create for
the limit that i am given. I have to create a new app in .net, per my
instructions, but the dll uses variant arrays, and i keep getting an
error whenever i pass an object array from my .net app to the vb6 dll
which needs to receive a variant array.

The error "Specified array was not of the expected type." always
occurs. I do not know what else to do besides going into the dll
(which i have been told specifically not to touch as of this time
since there are too many other apps that use it.)

Any help in this matter would be greatly appreciated.

Thanks,
Chris
 
G

Guest

Try declaring the object array as "System.Array" instead.
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
C++ to C# Converter: converts C++ to C#
Instant C++: converts C# or VB to C++/CLI
 
M

Mr. Arnold

Hello,

I am having trouble upgrading my VB apps to .net. When i started at
my company there was a dll created here in vb6, and i need to use that
dll for many functions that would take too much time to re-create for
the limit that i am given. I have to create a new app in .net, per my
instructions, but the dll uses variant arrays, and i keep getting an
error whenever i pass an object array from my .net app to the vb6 dll
which needs to receive a variant array.

The ;ink talks about Variant being out in .NET. You might be able to pass a
type as Object.

http://www.windowsdevcenter.com/pub/a/oreilly/windows/news/developasp_0401.html
The error "Specified array was not of the expected type." always
occurs. I do not know what else to do besides going into the dll
(which i have been told specifically not to touch as of this time
since there are too many other apps that use it.)

Any help in this matter would be greatly appreciated.

You might have to write this data out to a file or something. And with
another VB 6 COM component read that file and populate it in to a Variant
type and give that to the other COM component you're talking about.
 
B

buzzluck68

Try declaring the object array as "System.Array" instead.
--
David Antonwww.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
C++ to C# Converter: converts C++ to C#
Instant C++: converts C# or VB to C++/CLI

I tried that, and it still gave the error. I think i will try what
Mr. Arnold suggested below to create a VB6 COM component that will
read in the passed objects and transform them to a Variant array. It
might be my best (if not only) option for now. Thanks though.

Chris
 
B

buzzluck68

The ;ink talks about Variant being out in .NET. You might be able to pass a
type as Object.

http://www.windowsdevcenter.com/pub/a/oreilly/windows/news/developasp...





You might have to write this data out to a file or something. And with
another VB 6 COM component read that file and populate it in to a Variant
type and give that to the other COM component you're talking about.

I was able to build a vb6 COM dll that read in a text file of data
that my .net app exports the object values to. This worked...thanks
for the help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top