
how to pass the array from vb to vbscript
Quote:
>can you tell me how to pass the array from vb to vbscript?
>i use statement like: sc.run "procedure_name",array_param.
>and how to receive that array from vbscript and how to
>manipulate that array in vbscript.
(Having problems with my newsserver, this may be a double
posting)
PRB: Script Error Occurs When Referencing Non-variant
Array (Q165967)
http://support.microsoft.com/default.aspx?scid=kb;EN-
US;q165967
HOWTO: Return Arrays from Server-Side Objects in ASP
(Q174576)
http://support.microsoft.com/default.aspx?scid=kb;EN-
US;q174576
HOWTO: Implement Array Arguments in Visual Basic COM
Objects for Active Server
Pages (Q217114)
http://support.microsoft.com/default.aspx?scid=kb;EN-
US;q217114
From a previous newsgroup thread:
<qoute>
Subject: Re: Passing Arrays from VBScript to COM Object
Newsgroups: microsoft.public.scripting.vbscript
Date: 2000/01/10
Your COM object's method needs to accept a variant
argument containing an array of variants. To return an
array, do the same thing in reverse - build an array of
variants and return it in a variant. In the script you
simply pass the array as an argument as an ordinary
variable and return an array from a function into an
ordinary variable.
'A VB component method with a variant array
'passed in a variant argument...
'
Public Sub testMethod(ByRef theArray As Variant)
...
...use IsArray(theArray) to sanity check...
...
End Sub
'A VB component function returning a variant array
'as a variant return value...
'
Public Function testFunction(ByRef someArgument As
Variant) As Variant
Dim myArray(9) As Variant
...
...load myArray
...blah, blah...
...
testFunction = myArray
End Sub
In the script client...
Dim FooArray(3)
...
...load FooArray
...
myObject.testMethod FooArray
...
whatever = "whatever"
BarArray = myObject.testFunction(whatever)
a = BarArray(0)
b = BarArray(1)
...
--
Michael Harris
</qoute>
--
torgeir