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

using an array twice; problem with DIM 1

Status
Not open for further replies.

MikeT

IS-IT--Management
Feb 1, 2001
376
US
I do alot of date oriented stuff, so I wrote a script to generate a dropdown list of dates; it shows the last 52 Sundays. I used an array to store all of this info, then put it into the dropdown. I use this script as an #INCLUDE wherever I need a dropdown of Sundays. Now I need the user to choose 2 Sundays, and I can't #include the script twice because of the two DIMs for declaring the array. I tried doing a Sundays()=nothing between the two #include calls, but that didn't work. How can I get around this?
 
Good point, I forgot about that...
 
You can also Dim the array using the "Array" function

Dim arrArray
arrArray = Array(Sunday1, Sunday2, Sunday3)

' More code here
'.
'.
'.

arrArray = Array(Sunday1, Sunday2)

Indexing starts at 0.

This is a nice technique, because you can also set your variable to single value.

arrArray = Sunday

Zy
 
You can DIM your array in the file including the include-file...
Like this:


Code:
Dim arrSundays(51)
<!--#INCLUDE FILE=&quot;../Includes/Sundays.asp&quot;-->
[...]
<!--#INCLUDE FILE=&quot;../Includes/Sundays.asp&quot;-->
This is not a bug - it's an undocumented feature...
;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top