Is is possible to have a dimensioned variable name like Var(1), Var(2), ... so that you can go through a loop<br><%<br>For I= 1 to 5<br><br>Response.Write Var(I)<br><br>Next<br>%><br><br>This format is not working.
well i couldnt get u clearly..but if its just for printing values of i then u can write<br><br><%<br>For I= 1 to 5%><br><br><%=I%><br><br><%Next<br>%><br><br><br>
I don't want to print the numbers. Let's say Var(1)="James", Var(2)="Mike", Var(3)="Bob", Var(4)="Billy", and Var(5)="Fred".<br><br>I want to print the values of Var(1) through Var(5). <br><br><%<br>For count= 1 to 5<br> Response.Write Var(count)<br>Next<br>%><br><br>This does not work because it does not return the value of count for each variable.<br> I don't think it can be done with a loop, but if it could, it would save me a lot of time and make the program much more flexible.
Just define the array before you try to use it. For example, if you expect to have 5 values, at the top of the routine or page,<br><br>Dim var(4)<br><br>arrays are zero-based. <p>nick bulka<br><a href=mailto: > </a><br><a href= > </a><br>
Thanks,<br><br>I tried this and it still didn't work for my situation. I have the array variable in a request.form as in request.form(var(i)).<br><br>I can <br><br>response.write(i)<br><br>with i=1 and the output is 1 but when I <br><br>response.write(request.form(var(i))) <br><br>it will not return the value of the input. However I can hard code the numbers and <br><br>response.write(request.form(var(1))) <br><br>does return the value of the input.<br><br>Sorry for all the trouble. I am still learning what it can and cannot do.
um, I would think just doing<br><br>Response.Write Var(j)<br><br>or whatever the loop value is. <p>Karl<br><a href=mailto:kb244@kb244.8m.com>kb244@kb244.8m.com</a><br><a href=
</a><br>Experienced in , or have messed with : VC++, Borland C++ Builder, VJ++6(starting),VB-Dos, VB1 thru VB6, Delphi 3 pro, Borland C++ 3(DOS), Borland C++ 4.5, HTML,Visual InterDev 6, ASP(WebProgramming), QBasic(least i didnt start with COBOL)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.