473,782 Members | 2,479 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 6000
Try declaring the object array as "System.Arr ay" 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********@hot mail.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********@hot mail.comwrote in message
news:11******** ************@h2 g2000hsg.google groups.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...@dis cussions.micros oft.com>
wrote:
Try declaring the object array as "System.Arr ay" instead.
--
David Antonwww.tangib lesoftwaresolut ions.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...@hot mail.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.c omwrote:
<buzzluc...@hot mail.comwrote in message

news:11******** ************@h2 g2000hsg.google groups.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
4890
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 scripting language, Python. I have tried everything by I'm going crazy here. Here is what I have...
2
13438
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 bBytes)" or "void Write(byte bBytes, int nLen)" or "int Write(byte bBytes, int nLen)"VBScript returns a "Invalid procedure call or argument" exception. However when I define the method as "int Write(byte bBytes)" it works just fine. Unfortunately...
2
9590
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 averages (they're actually processing a sequence of pairs of variants and the sequence is of unknown length). I want something like these two functions:
3
3796
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 a variant containing an array, and interop expects a parameter of type object if you are passing a variant (you are expected to cast it to the correct type in your code). I'd like to find a way of passing arrays so that you don't need to change...
1
2146
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 syntax would (allegedly) work in VB6. The object is called RhinoScript: RhinoScript.AddLine Array(0, 0, 0), Array(10, 0, 0) Now, this syntax causes VB.NET to choke at compile-time. I have replaced it with the following (and have tried several
0
2077
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
2521
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 Error GoTo err_zoom strFormName = formName
0
2024
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: public object MyMethod(string inputData)... I wrote a test harness in VB6 to test the method. I can call the method
5
4033
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) #mat1=mat((vol)) #up=linalg.inv(mat1) return str(val)#up
0
9641
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10080
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6735
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2875
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.