473,387 Members | 1,485 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Passing Object Array back to Variant array.

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

Jun 4 '07 #1
4 5973
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
"bu********@hotmail.com" wrote:
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

Jun 4 '07 #2

<bu********@hotmail.comwrote in message
news:11********************@h2g2000hsg.googlegroup s.com...
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/...pasp_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.
Jun 4 '07 #3
On Jun 4, 3:07 pm, David Anton <DavidAn...@discussions.microsoft.com>
wrote:
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

"buzzluc...@hotmail.com" wrote:
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
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

Jun 5 '07 #4
On Jun 4, 5:14 pm, "Mr. Arnold" <MR. Arn...@Arnold.comwrote:
<buzzluc...@hotmail.comwrote in message

news:11********************@h2g2000hsg.googlegroup s.com...
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/...ews/developasp...
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.
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.

Jun 6 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Raoul | last post by:
I wrote a COM server object in C++ a few months ago. I can use it from Visual Basic, Visual C++, S-Plus and a number of other scripting environments. What I can't do is use it with my FAVOURITE...
2
by: Ken Layton | last post by:
Attempting to pass a VBScript Array of Bytes to a C# Managed COM object has resulted in some very undesirable and strange behavior. When definining a method in my C# COM class as "void Write(byte...
2
by: Edlueze | last post by:
Greetings: I have two functions and I would like to pass the ParamArray gathered from one function to the other function. For the purposes of this post, let's say that they are calculating...
3
by: Mark | last post by:
Hi From what I understand, you can pass arrays from classic ASP to .NET using interop, but you have to change the type of the.NET parameter to object. This seems to be because classic ASP passes...
1
by: Gregory Hassett | last post by:
Hello, I am calling into a legacy COM server from VB.NET. The method that I am calling expects an array. Here is the example syntax provided by the author of this COM automation object -- this...
0
by: sathya.krishnamurthy | last post by:
Hello Everybody I have an C++ COM DLL with the following implementation. __interface ICPM : IDispatch { HRESULT GlobalComputeClass ( VARIANT *inArr, double *pval); }
13
by: Deano | last post by:
Apparently you can only do this with one value i.e Call MyAssetLocationZoom(Me!txtLocation, "Amend data") This runs; Public Sub MyAssetLocationZoom(ctl As Control, formName As String) On...
0
by: dwinson | last post by:
I am writing an add-in in C# for a server written in VB6. In order for my add-in to work I need to implement this method: MyMethod(string inputData) .... so my C# code looks like this: ...
5
by: vml | last post by:
I have a python com object which contains a method to inverse an array in vb 6 the definition of the class is : class Fop: _public_methods_ = def SqVal(self,*val): #vol=(val,val)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.