Re: Dim Array Problem in VBScript
by "Tom Keatley" <tom(at)piedpiper.com.au>
|
| Date: |
Sun, 27 Feb 2000 07:02:34 +0800 |
| To: |
"Shull, Conrad" <cshull(at)shscares.org>, <hwg-languages(at)hwg.org> |
| References: |
ntmail1 |
| |
todo: View
Thread,
Original
|
|
> I need to DIM an array with a value (t) determined by a string
> passed via a form (Request.Form("c")).
> Why won't the following script work? The statement "Dim q(t)"
> generates the error, "Expected integer constant" although
> I've made the "Request.Form" string result into an integer
> varient type with "Cint". Do I HAVE to use a literal integer
> where I want to use the varible "t"?
> (When I use 1,2,3, etc., it works, but I have to know the
> value of "t" ahead of time,
> which defeats the purpose of what I'm trying to do.)
> <%
> Dim i
> Dim t
> t = Cint(Request.Form("c"))
> Dim q(t)
> For i = 1 to t
> q(i) = Request.Form(i)
> Next
> %>
Hi Conrad...
I dont know the answer to your question as I know nothing about VB script
but have done a little programming in VB (Access) and you declaration
statement looks odd to me ......surely you need to declare the variables of
your array separately
and THEN declare your array.
<%
Dim i
Dim t
Dim q
t = Cint(Request.Form("c"))
For i = 1 to t
q(i) = Request.Form(i)
Next
%>
As already stated I know nothing of VBscript so I have answered mainly to
provoke comment from others...
the other thing ...Dont you have to declare your variables AS something
dim i as integer etc)
hope It has helped (probably not)
Tom Keatley
HWG: hwg-languages mailing list archives,
maintained by Webmasters @ IWA
This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.