Passing Array of Java Strings to VBScript 
Author Message
 Passing Array of Java Strings to VBScript

I've read many postings about this issue but still have not been able
to make mine work, I keep getting a 'type mismatch' error in my
VBScript.

I have a Java method defined as follows:

public com.ms.com.Variant[] rptReturn = new com.ms.com.Variant[504];
public SafeArray safe = new SafeArray(Variant.VariantVariant,504);

// method definition
public com.ms.com.SafeArray copyReturn()
{
    int k=0;
    for(int i = 0; i < 28; i++)
        for(int j = 0; j < 18; j++)
        {
             rptReturn[k] = new com.ms.com.Variant();
             rptReturn[k++].putString(rptRawData.vals[i][j]);
        }
        safe.setVariants(0,504,rptReturn,0);
        return safe;

Quote:
}

and vbscript as follows:

<%   set rptPpo120 = Server.CreateObject("/scripts.Ppo120")
        dim rtn
        redim rtn(504)
        rtn = rptPpo120.copyReturn
%>
...
<%   for j = 0 to 17 %>

<FONT STYLE="ARIAL NARROW" COLOR="#FFFFFF" SIZE=2><%=rtn(j) %></FONT>

<%      next%>
...

I'm taking my 2 dim array and putting it into 1 to keep things simple
with the safearray. And passing the safe array back to my VBScript.
When I try to access the safearray 'rtn(j)' in VBScript I get a "Type
Mismatch" error.

Any help would be greatly appreciated,

Thanks

--
Bohdan Dackow

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Tue, 07 Jan 2003 03:00:00 GMT  
 Passing Array of Java Strings to VBScript
Try:

dim rtn
rtn = rptPpo120.copyReturn

--
Michael Harris
MVP Scripting

I've read many postings about this issue but still have not been able
to make mine work, I keep getting a 'type mismatch' error in my
VBScript.

I have a Java method defined as follows:

public com.ms.com.Variant[] rptReturn = new com.ms.com.Variant[504];
public SafeArray safe = new SafeArray(Variant.VariantVariant,504);

// method definition
public com.ms.com.SafeArray copyReturn()
{
    int k=0;
    for(int i = 0; i < 28; i++)
for(int j = 0; j < 18; j++)
{
             rptReturn[k] = new com.ms.com.Variant();
     rptReturn[k++].putString(rptRawData.vals[i][j]);

Quote:
}

safe.setVariants(0,504,rptReturn,0);
return safe;

Quote:
}

and vbscript as follows:

<% set rptPpo120 = Server.CreateObject("/scripts.Ppo120")
dim rtn
redim rtn(504)
rtn = rptPpo120.copyReturn
%>
...
<% for j = 0 to 17 %>

<FONT STYLE="ARIAL NARROW" COLOR="#FFFFFF" SIZE=2><%=rtn(j) %></FONT>

<%      next%>
...

I'm taking my 2 dim array and putting it into 1 to keep things simple
with the safearray. And passing the safe array back to my VBScript.
When I try to access the safearray 'rtn(j)' in VBScript I get a "Type
Mismatch" error.

Any help would be greatly appreciated,

Thanks

--
Bohdan Dackow

Sent via Deja.com http://www.deja.com/
Before you buy.



Tue, 07 Jan 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Passing String arrays from Java to JavaScript ?

2. Passing a string array in VBScript

3. Passing arrays from javascript to a java applets

4. Passing arrays to COM java objects from JScript (Server Side)

5. Passing Array of string to component

6. Passing array of strings from ASP (JScript) to ATL COM

7. Funny passing a text string from a database field to a Javascript global array

8. Calling Java Classes from a Java jar library from VBScript

9. passing variable from java/j script to vbscript

10. VB array to Java Array

11. String to Array and Array to String

12. passing string arrays, v2.0

 

 
Powered by phpBB® Forum Software