G
Gregory Hassett
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
other ways of creating the array, as well):
Dim a As Array =
Array.CreateInstance(GetType(Int32), 0, 0, 0)
Dim b As Array =
Array.CreateInstance(GetType(Int32), 10, 0, 0)
RhinoScript.AddLine(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?
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
other ways of creating the array, as well):
Dim a As Array =
Array.CreateInstance(GetType(Int32), 0, 0, 0)
Dim b As Array =
Array.CreateInstance(GetType(Int32), 10, 0, 0)
RhinoScript.AddLine(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?