Passing array from ASP (VBScript) to DLL and back 
Author Message
 Passing array from ASP (VBScript) to DLL and back

I am trying to port an application from VB (Std. EXE) to the web via ASP and
using a DLL in an attempt to share as much code as possible. My problem is
returning a variable to the ASP page for use in a VBScript routine. Any
clues or pointers?


Sat, 10 Nov 2001 03:00:00 GMT  
 Passing array from ASP (VBScript) to DLL and back
This probably isn't the best way, you aren't actually passing an array back
and forth, but is the only way I know how.  What you do is convert your
array into a delimited string.

array(1) = "a"                   ==                strVar = "a,b,c"
array(2) = "b"
array(3) = "c"

You can pass the info to the DLL this way.  Inside the DLL, use the
Split(expression[, delimiter[, count[, compare]]]) function to separate the
values back into an array.

http://msdn.microsoft.com/scripting/vbscript/doc/vsfctSplit.htm

Do the same when passing an array from the DLL to the asp page.

This also works great if you don't want to specify how long an array has to
be.  If you are creating an array that could hold 9 records or 999, why use
the memory and dim array(999) and then get an error if you go over (ReDiming
sucks).  Just create one variable with delimited data and split it into an
array.

Hope this helps.

Craig Kohtz
http://www.periodically.com



Quote:
> I am trying to port an application from VB (Std. EXE) to the web via ASP
and
> using a DLL in an attempt to share as much code as possible. My problem is
> returning a variable to the ASP page for use in a VBScript routine. Any
> clues or pointers?



Sun, 11 Nov 2001 03:00:00 GMT  
 Passing array from ASP (VBScript) to DLL and back
P.S.  Use the UBound(arrayname[, dimension]) function to find the length of
the array.

http://msdn.microsoft.com/scripting/vbscript/doc/vsfctUBound.htm

Craig Kohtz
http://www.periodically.com



Sun, 11 Nov 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

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

2. VB5: Passing Arrays to a DLL and back

3. Passing Array to Session Variable Then back to Array

4. Passing Arrays into VbScript from a VB dll

5. Passing arrays from VBScript to VB DLL

6. Passing Arrays to a VB 5.0 SP3 DLL using VBScript control

7. passing array from VBScript to Visual Basic ActiveX DLL

8. Passing Arrays to a Function in ASP (VBScript)

9. Passing MultiDimensional Array from ASP to VBScript

10. Pass array from ASP to VB ActiveX DLL

11. Passing an Array from an Active X .dll to ASP

12. Passing arrays from VB DLL to ASP

 

 
Powered by phpBB® Forum Software