[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

how to pass variant array from vbs to vb.net COM-dll?

wundertier@web.de

10/8/2007 11:38:00 AM

Hi,
I rewrote some VB6 code to vb.net. I is a COM-dll which must be
callable by VB Script.
Here is a part of the VB Script code:
---
Dim vDocument_Data(2,1)
vDocument_Data(0,0) = "STR0"
vDocument_Data(0,1) = "First line"
vDocument_Data(1,0) = "STR1"
vDocument_Data(1,1) = "second line"
vDocument_Data(2,0) = "STR2"
vDocument_Data(2,1) = "third line"
....

Dim dllObject
Set dllObject = CreateObject("MyApp.Application")
dllObject.ExecuteFunction param1, param2, param3, vDocument_Data
---

My problem is: How do I have to declare the ExecuteFunction method in
my vb.net dll code (interface and class)?
I tried the following:

Function ExecuteFunction(ByVal param1As String, _
ByVal param2 As String, _
ByVal param3 As String, _
Optional ByRef vTables_Data As Object = Nothing _
) As Boolean

Executing the vb script returns the following error message:
458 Variable uses Automation type not supported in VB

Changing the type of vTables_Data from Object to Array yields the
following:
5 Invalid procedure call or argument

I also tried different combinations using the MarshalAs attribute, but
with no effect.
ByVal - ByRef - no effect.
And I tried to replace the 2-dimensional array in the vbs code by a
one-dimensional - no effect.
(And changing the vb script is not an option, as our customers don't
want to modify their vb scripts.)

I searched msdn but did not find anything useful. google - nothing

Does anybody know how to pass this variant array from vbs to vb.net
com-dll??
Any help would be greatly appreciated!

Regards
Steffi