
HELP! Subscript Out Of Range error referencing array
Howdy folks,
I've been working on an ASP application for the last week or so which I've
done some funky things with, including parsing the query string returned
from posting a form into an array which I then want to use elsewhere. This
is all Server-side VBScript btw...
Now... the problem I'm having is that if I use standard VB conventions for
passing this array into functions and subprocedures I'm either getting an
"array subscript out of range" or "object required", depending on what I'm
trying to do.
I've tried to make the Array public in the code that runs when the ASP page
loads to see if this makes a difference but it doesn't seem to.
The basic structure is:
------------------------------------------------------------
<%
public Args (20,2)
'other dim statements
'sub and function declarations
Sub listArgs()
dim i
if UBound(Args) <> 0 then
for i = LBound(Args) to UBound(Args)
response.write(Args(i,0) & "=")
response.write(Args(i,1) & "<br> & vbCrLf)
next
end if
end sub
'Feed the pairs from the query string into the Args() array
ListArgs
%>
------------------------------------------------------------
All pretty simple but the Ubound function is returning Object Required
messages and remming out the "if" and "for" constructs gives me Subscript
Out Of Range errors [even for Args(0,0)]. I've tried passing Args() as a
parameter as well but with identical results.
I'm now starting to wonder if VBScript actually supports the passing of
arrays to functions at all. If someone could shoot me an email letting me
know what I've done wrong I'd be very grateful.
Thanks
Jeremy
http://www.*-*-*.com/