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.Add Line 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
other ways of creating the array, as well):
Dim a As Array =
Array.CreateIns tance(GetType(I nt32), 0, 0, 0)
Dim b As Array =
Array.CreateIns tance(GetType(I nt32), 10, 0, 0)
RhinoScript.Add Line(a, b)
This compiles, but at runtime I get an error "parameter
type mismatch -- parameter must be an array."
I suspect that I am passing a CLR Collection Object (Array)
when the legacy COM Automation Server wants an old-style
SafeArray in a VARIANT. How do I circumvent this problem? 1 2147
Hi Gregory,
I think you may try to change your code as follows.
RhinoScript.Add Line(New Object(){0, 0, 0}, New Object(){10, 0, 0})
For more details ,take a look at link below.
Function has a new behavior http://msdn.microsoft.com/library/de...us/vbcon/html/
vbup1041.asp
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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...
|
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...
|
by: Eric Ellsworth |
last post by:
Hi,
I'm having trouble passing an array to a function,
like this:
Dim sFieldsNotRequired(11), sFieldsWithSpecificValues(5) As String
Dim sCaseErrMsgs As String
Dim vFieldsSpecificValues(5) As Variant
sFieldsNotRequired(0) = "middleName"
|
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:
|
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...
| |
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);
}
|
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
|
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
|
by: buzzluck68 |
last post by:
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...
|
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...
|
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,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |