Click to See Complete Forum and Search --> : Array in ASP passing to VB


Chuck Inn
April 18th, 2001, 11:59 AM
I want to pass an array from ASP to a VB component.
dim arr

arr = array("one","two","three")

call vbcomponent.subname(arr)

***************************************************

The sub in the VB component would be defined as:

public sub(byval somevariablename as variant)

blah blah blah

end sub

*************************************************

The above I can do when I know which are the values I need to put in the array so I can call the array function as in the second line. This executes perfectly.

If however I want to populate the array through some variables and then pass it to the VB component then what do i do?

I did the following:

***********************************************
dim arr()
dim var1
dim var2
dim var3
dim var4
redim arr(4)

*do operation to populate the array*

arr(0)=var1
arr(1)=var2
arr(2)=var3
arr(3)=var4

call vbcomponent.subname(arr)
***********************************************

This gives me an error. Seems I can't pass the "arr" variable like this from ASP. Debugger stops me right at the function beginning ... doesn't even go inside the function.

So I do the following:

call vbcomponent.subname(array(arr))

This type casting works in the sense i get into the function and executing code inside it. But the problem I get is
now the array inside the VB component function works like a double dimension array ... at least initial checks make me feel that.


FINALLY MY QUESTION:

How to properly pass a array from ASP to a VB component when I don't want to make the array in ASP as -

arr = array("one","two","three")