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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using a variable to declare the size of an array 2

Status
Not open for further replies.

drew10

Programmer
Feb 26, 2002
123
US
I have a variable called propertycount. I would like to create an array the size of the propertycount. Like array(propertyCount). Is this possible, and if so how do i do it. Thanks in advance.
 
<%
Dim iPropertyCount

iPropertyCount = 5

ReDim sArray(iPropertyCount)
sArray(5) = &quot;hello&quot;
sArray(6) = ERROR - Subscript out of range.
%>

I tested this on IIS 5 and it works! I hadn't tried it till you mentioned it. You can't use Dim sArray() but you can use ReDim sArray() to do what you want. If you use Dim, the server reports an error saying that a constant value was expected.

Hope this helps! Brett Birkett B.Comp
Systems Analyst
 
Don't forget to vote!!! :) Brett Birkett B.Comp
Systems Analyst
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top