array question

Results 1 to 2 of 2

Thread: array question

  1. #1
    Join Date
    Dec 1969

    Default array question

    i have this code<BR>dim myarr()<BR>x=0<BR>for each val in request.form("dsfs")<BR>myarr(x)=val<BR>x=x+1<BR>n ext <BR><BR>for each value in myarr<BR>response.write(value)<BR>next<BR><BR>this gives me a subscript out of range error in myarr(x)=val<BR>if i declare redim myarr(5) then it works fine but it loops 6 times in the second for loop showing the blank values.<BR>Why isnt the array being dynamic when i declare it the dynamic way. ?<BR><BR>brij <BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: array question

    dim myarr() <BR>x=0 <BR>ReDim Preserve myarr(request.form("dsfs").count)<BR><BR>for each val in request.form("dsfs") <BR>myarr(x)=val <BR>x=x+1 <BR>next <BR><BR>for each value in myarr <BR>response.write("#"&value) <BR>next <BR>%&#062;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts