Two Dimensional Array
Posted on 2005-04-30
I am having difficulty wrapping my mind arround 2D arrays. I need to set one up based on user input. Example: User gives me blood pressure reading and Cholesterol reading in 2 numeric updown boxes and I return an assigned rating to the user from looking up the value in an array when they hit the submit btn.
I have several questions... so please bear with me as I learn.
The real table is much bigger, but for example sake... let use a 3x3:
120/80 1.5 2.0
130/90 2.5 3.0
Q1: Do I include the Column and row headings in the array set up?
Dim strArray(3,3) as String
StrArray(0,1) = "200"
StrArray(0,2) = "250"
StrArray(1,0) = "120/80"
StrArray(1,2) = "2.0"
StrArray(2,0) = "130/90"
StrArray(2,1) = "2.5"
StrArray(2,2) = "3.0"
Q2: When I have the values from the user, how do I use that to look up the rating?
strRating=strArray(bp,cholest) /I'm guessing here. And i'm guessing I would need to declare and set these two variables up prior to using them.... lol
I have been quasi-successful modifying an array in the past. But have never had to set one up from scratch.
And, I feel so lost. I'm trying to meet a deadline, that's why the points have been assisgned at 500. As always, I appreciate any and all help!! Many Thanks! Michelle