[thelist] ASP For Each...Next problem
Wade Armstrong
wade_lists at runstrong.com
Tue Jul 22 13:24:57 CDT 2003
on 7/22/03 8:44 AM, Michael Robertson at mike at mikeemedia.com wrote:
>
> I'm trying to loop through 2 arrays filled with dates to find out if any of
> the dates in said arrays are the same. This is latest thing I've tried and
> it seems like it should work but i get a type mismatch on the second For
> each line.
>
> For Each FormDate In ArrFormDate
> For Each CurrDate In ArrCurrentDates(0,FormDate)
> If ArrFormDate(FormDate) = ArrCurrentDates(0,CurrDate) Then
> blnIsSame = True
> End If
> If blnIsSame = True Then
> Exit For
> End If
> Next
> Next
>
> ArrCurrentDates is populated like so:
> ArrCurrentDates = RS.GetRows()
>
> ArrFormDate like:
> strFormDate = Request.Form("Date")
> ArrFormDate = Split(strFormDate,",")
You usually iterate through arrays using a construct like:
Dim I
If isArray(array) Then
For i = LBound(array, dimension) To UBound(array, dimension)
...
Next
End If
The For Each construction is usually used with collections, like
Request.Form.
I think it has something to do with the values of an array being ordered,
and the values of a collection being unordered.
Wade
More information about the thelist
mailing list