[thelist] asp/vb - array problem

Dunstan Orchard dunstan at 1976design.com
Thu Dec 18 17:44:55 CST 2003


Hi there,

Can anyone help me out with  a bit of ASP/VB please?

I have a bunch of variables (somtimes 30 or more), with values of either 
'on' or ''. I need to take those values, and change them into '-1' and '0's.

I thought the best way was to smack them all into an array and then loop 
through the array altering them one at a time.

However, I'm confused as to how to do this. The code below seems to 
work, in that the values get checked and altered, but the values are 
only altered for the variables _inside_ the array. If I check, say 
's4ACE' later on in the page, then it still has its original value.

***************************************
Dim aCheckboxes
aCheckboxes = Array(s4ACE, s4ACSM, s4AFAA, s4APTA, s4NATA, s4Other,
s5AAHPERD, s5ACSM, s5AFAA, s5APTA, s5IHRSA, s5NATA, s5Other,
s7ADMINISTRATION, s7AT, s7EDUCATOR, s7EXPHYS, s7HLTHCLUB, s7PERSTRAIN,
s7PTHER, s7RESRCH, s7SPRTCOACH, s7SnCCOACH, s7STUDENT, s7Other, s10AFQ,
s10AJSM, s10ATHBUS, s10BFS, s10CLUBUSINT, s10CLBIND, s10FITMGMT,
s10IDEA, s10JRNLAT, s10JOSPT, s10MSSE, s10NATA, s10NCAA, s10PnSPTS,
s10SCHOLCH, s10TnC, s10Other)

Dim i
For i = 0 To UBound(aCheckboxes)
  If aCheckboxes(i) = "on" Then
   aCheckboxes(i) = -1
  ElseIf aCheckboxes(i) = "" Then
   aCheckboxes(i) = 0
  End If

' AS THIS FINISHES I NEED THE VALUE OF THE VARIABLE TO BE ALTERED SO I 
CAN USE IT LATER ON, WITHOUT HAVING TO CALL IT FROM WITHIN THE ARRAY
Next
***************************************

Does anyone have any ideas as to how I can do what I want?

Thanks very much,

- Dunstan

-------------------------------------
Dorset, England
Work: http://www.1976design.com/
Play: http://www.1976design.com/blog/
Learn: http://webstandards.org/



More information about the thelist mailing list