Returning arrays from VB/VC components or VBScript to JavaScript in ASP 
Author Message
 Returning arrays from VB/VC components or VBScript to JavaScript in ASP

I was trying to return an array from a VB COM component to my ASP which is
coded in JavaScript.
The JavaScript variable does not get any value.
If  I receive the return value in a VBScript variable, it works fine!!

I could not even return an array from a VBScript function to a JavaScript
variable.

I need to pass an array of strings from a VB/VC COM component to a
JavaScript variable in my
ASP.  Is there a way to do this?!

 thanks :)
 - Zubin



Sun, 02 Mar 2003 03:00:00 GMT  
 Returning arrays from VB/VC components or VBScript to JavaScript in ASP
You have to return it as a function return value, not as a ByRef parameter.  JScript doesn't support
ByRef...

--
Michael Harris
Microsoft.MVP.Scripting
--


Quote:
> I was trying to return an array from a VB COM component to my ASP which is
> coded in JavaScript.
> The JavaScript variable does not get any value.
> If  I receive the return value in a VBScript variable, it works fine!!

> I could not even return an array from a VBScript function to a JavaScript
> variable.

> I need to pass an array of strings from a VB/VC COM component to a
> JavaScript variable in my
> ASP.  Is there a way to do this?!

>  thanks :)
>  - Zubin



Sun, 02 Mar 2003 03:00:00 GMT  
 Returning arrays from VB/VC components or VBScript to JavaScript in ASP
you can only have primative types as return values (int, byte, *void,
ect...)

the reason it works in vb is because it defaults to passing the data
stucture (array)
by reference instead of by value.  It's strange becuase i would also thank
the the
defualt would be the same in javascript.  You need a way to make it return
by reference
(by pointer) because retuning an array by value is illegal in most
languages.

-bryan


Quote:

> I was trying to return an array from a VB COM component to my ASP which is
> coded in JavaScript.
> The JavaScript variable does not get any value.
> If  I receive the return value in a VBScript variable, it works fine!!

> I could not even return an array from a VBScript function to a JavaScript
> variable.

> I need to pass an array of strings from a VB/VC COM component to a
> JavaScript variable in my
> ASP.  Is there a way to do this?!

>  thanks :)
>  - Zubin



Mon, 03 Mar 2003 03:00:00 GMT  
 Returning arrays from VB/VC components or VBScript to JavaScript in ASP
Hi,

I was reading this topic and hope now you can help me shortely.

I try to return an array as return value from a vb com function to an asp

vbscript array variable.

dim arr()

arr() = mycommfunction(dd)

this is the vb function:

Public function mycommfuntion(byval dd as string) as variant()

You wrote here that you haden't any problems to pass the returnvalue to a

var in VBScript.

Quote:
>>> If I receive the return value in a VBScript variable, it works fine!!

could you give me a hint how you've done this?

thx

Chris


Quote:
> you can only have primative types as return values (int, byte, *void,
> ect...)

> the reason it works in vb is because it defaults to passing the data
> stucture (array)
> by reference instead of by value. It's strange becuase i would also thank
> the the
> defualt would be the same in javascript. You need a way to make it return
> by reference
> (by pointer) because retuning an array by value is illegal in most
> languages.

> -bryan



> > I was trying to return an array from a VB COM component to my ASP which

is

Quote:
> > coded in JavaScript.
> > The JavaScript variable does not get any value.
> > If I receive the return value in a VBScript variable, it works fine!!

> > I could not even return an array from a VBScript function to a

JavaScript

Quote:
> > variable.

> > I need to pass an array of strings from a VB/VC COM component to a
> > JavaScript variable in my
> > ASP. Is there a way to do this?!

> > thanks :)
> > - Zubin




- Show quoted text -

Quote:
> you can only have primative types as return values (int, byte, *void,
> ect...)

> the reason it works in vb is because it defaults to passing the data
> stucture (array)
> by reference instead of by value.  It's strange becuase i would also thank
> the the
> defualt would be the same in javascript.  You need a way to make it return
> by reference
> (by pointer) because retuning an array by value is illegal in most
> languages.

> -bryan



> > I was trying to return an array from a VB COM component to my ASP which
is
> > coded in JavaScript.
> > The JavaScript variable does not get any value.
> > If  I receive the return value in a VBScript variable, it works fine!!

> > I could not even return an array from a VBScript function to a
JavaScript
> > variable.

> > I need to pass an array of strings from a VB/VC COM component to a
> > JavaScript variable in my
> > ASP.  Is there a way to do this?!

> >  thanks :)
> >  - Zubin



Tue, 04 Mar 2003 03:00:00 GMT  
 Returning arrays from VB/VC components or VBScript to JavaScript in ASP

dim arr
arr = mycommfunction(dd)

--
Michael Harris
Microsoft.MVP.Scripting
--



Tue, 04 Mar 2003 03:00:00 GMT  
 Returning arrays from VB/VC components or VBScript to JavaScript in ASP
When I run code,

...
nValue = arr(0)
...

it gives me error message as follows:

==============================================
Microsoft VBScript runtime error '800a000d'

Type mismatch
==============================================

and it return the VarType of the variable as 8194, instead of 8192 for
array.  The code is like,

...
VarType = <%=VarType(arr)%>
...

Please advise!

Marlon



Quote:

> dim arr
> arr = mycommfunction(dd)

> --
> Michael Harris
> Microsoft.MVP.Scripting
> --

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


Sat, 29 Mar 2003 03:00:00 GMT  
 Returning arrays from VB/VC components or VBScript to JavaScript in ASP
You can never get VarType of only 8192 - it always has be an array of
something...

8194 = 8192 (vbArray) + 2 (vbInteger)

In other words it's a strongly typed array of integers, not an array of
variants of subtype integer, and isn't usable from VBScript...
See:

Type Mismatch When Passing Parameters from ASP to VB
http://support.microsoft.com/view/dev.asp?kb=244012

Q165967 - PRB: Script Error Occurs When Referencing Non-variant Array
http://support.microsoft.com/support/kb/articles/Q165/9/67.ASP

--
Michael Harris
Microsoft.MVP.Scripting
--

Quote:

> When I run code,

> ...
> nValue = arr(0)
> ...

> it gives me error message as follows:

> ==============================================
> Microsoft VBScript runtime error '800a000d'

> Type mismatch
> ==============================================

> and it return the VarType of the variable as 8194, instead of 8192 for
> array.  The code is like,

> ...
> VarType = <%=VarType(arr)%>
> ...

> Please advise!

> Marlon



> > dim arr
> > arr = mycommfunction(dd)

> > --
> > Michael Harris
> > Microsoft.MVP.Scripting
> > --

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



Mon, 31 Mar 2003 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Returning arrays from VB/VC components or VBScript to JavaScript in ASP

2. C++ ActiveX Property returns VARIANT Array of BSTR for VBScript or JavaScript

3. C++ ActiveX Property returns VARIANT Array of BSTR for VBScript or JavaScript

4. Passing array between ASP script(vbscript) and javascript

5. vbscript, ASP, javascript, and two dimentional arrays

6. Problem with VC component in ASP-VB Script

7. Passing Arrays between ASP/VBScript and ActiveX Components...

8. Passing Arrays between ASP/VBScript and ActiveX Components...

9. Convert multi-dimension vbscript array to javascript array

10. problem using component with asp page -- result of function not returned, instead original value returned

11. Returning an object with sub objects from vb component (COM) to ASP

12. Can VB component return a Recordset to ASP?

 

 
Powered by phpBB® Forum Software