Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parameter within variable name 1

Status
Not open for further replies.

ksbigfoot

Programmer
Apr 15, 2002
856
CA
I have a for loop and I have to read parameters into variables, I will only show one parameter for simplicity.
Here is what I am trying to do
Code:
For i = 1 to 10
  strParam + i + Name = SomeValue
Next
So then I will have 10 parameters:
strParam1Name = SomeValue
strParam2Name = SomeValue
until strParam10Name = SomeValue

Does anyone know how to do this?
 
Changed my way of thinking, I am going to use an array instead.
 
you could use a dictionary, VbScript's version of an associative array

Code:
<%
dim i
dim objVarArray
set objVarArray = server.createobject("Scripting.Dictionary")	

for i = 1 to 10
objVarArray.add strParam & str(i) & "name" = SomeValue
next
%>

retrieve the value with
Code:
variable = objVarArray.item(strParam & str(num) & "name"


not forgetting to set objArray = Nothing when finished with.

or just an array

dim strParams(10)
for i = 1 to 10
strParams(i) = SomeValue
next



Chris.

Indifference will be the downfall of mankind, but who cares?
Woo Hoo! the cobblers kids get new shoes.
People Counting Systems

So long, and thanks for all the fish.
 
Howdy Chris,
Thanks for the post, I did decide to use an array.
Star to you,
ksbigfoot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top