Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 246
  • Last Modified:

creating variable names from looping statements

Hi

I'm trying to convert something like this:

q1 = cint(request.form("q1"))
q2 = cint(request.form("q2"))
q3 = cint(request.form("q3"))
q4 = cint(request.form("q4"))
q5 = cint(request.form("q5"))

into something like this:

for i = 1 to 5
      q&i = Request.Form(q&i)
next

any ideas?
0
arielbf
Asked:
arielbf
1 Solution
 
Bill PrewCommented:
Typically an array variable would be used for something like that, so you would have:

Dim q(5)
for i = 1 to 5
      q(i) = Request.Form("q" & i)
next

~bp
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now