converting Array to Variant and Variant to Array 
Author Message
 converting Array to Variant and Variant to Array

How save Array in variable of Variant (to give it to external) and Variant
to array

--

========================================
Sergius Adamtchouk aka tiex
Visit me http://www.*-*-*.com/



Sun, 26 Sep 2004 18:59:49 GMT  
 converting Array to Variant and Variant to Array

Quote:

> How save Array in variable of Variant (to give it to external) and
> Variant to array

To pass a JScript array to a COM function method expecting a ByVal VBScript-style SAFEARRAY and returning a SAFEARRAY...

ar = new Array()
ar[0] = "abc"
ar[i] = "xyz"
var d = new ActiveXObject("Scripting.Dictionary);
for(i=0;i<ar.length;i++){d.item(i)=ar[i]}

//pass d.Items() (which returns a SAFEARRAY) to the method
arVBArray = myobj.method(d.Items());
arReturn = VBArray(arVBArray).toArray();

If the argument is expected to be passed ByRef and modfifiied then you are out of luck since JScript doesn't support pass ByRef...

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US
--



Mon, 27 Sep 2004 10:18:09 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. convert jscript array to variant array

2. convert JScript Array to Array Variant

3. Passing variant containing byte array

4. Trying to pass a Variant Array of Doubles to ActiveX from HTML

5. Variant (array of bytes)

6. Variant arrays and GetRows()

7. Returning arrays of VARIANTs to VBScript

8. Passing a variant array from asp to a cls and back

9. Problem passing a variant array out of VBasic object to ASP

10. Variant Array

11. Collecting Variant Array's from da COM+

12. Returning Variants That Contains an Array to JScript

 

 
Powered by phpBB® Forum Software