Message 1 of 6
For Each - Next with a 2 dimensional array

Not applicable
05-01-2001
09:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have an array dimensioned (1 to 30, 1 to 3), and
I need to step through
the first dimension and look at one of the values in
the second dimension.
For example, in one situation, I would look at (1-30,1)
while in another
situation I would need to look at (1-30,2). Specifically, I
have a list of
30 items, with in effect a synonym (and sometimes two
synonyms), and at
different times I need to look up one based on another. The
data might look
something like this:
array (1,1) = "768": array (1,2) =
"1/64" & Chr(34) & "=1'": array (1,3) =
acVp1_64in_1ft
the last
being an AutoCAD constant that may or may not apply, as I am using
some
scales that AutoCAD has no constant for.
At times I need to step through
looking for "768" to get "1/64" & Chr(34)
&
"=1'": or acVp1_64in_1ft, at other
times I am searching for "1/64" & Chr(34)
&
"=1'" to get "768" .
At this point I am
doing this with an array, and would like to use For
Each - Next rather than a
counter. Then again, maybe there is a better data
structure for what I am
doing?
I had thought about using a collection, but I suspect I will
eventually want
to populate the data structure from a file or database, and
as far as I can
tell, a collection requires hard coding to define. Again I
may be wrong.
Any help is GREATLY
appreciated!
Gordon
I need to step through
the first dimension and look at one of the values in
the second dimension.
For example, in one situation, I would look at (1-30,1)
while in another
situation I would need to look at (1-30,2). Specifically, I
have a list of
30 items, with in effect a synonym (and sometimes two
synonyms), and at
different times I need to look up one based on another. The
data might look
something like this:
array (1,1) = "768": array (1,2) =
"1/64" & Chr(34) & "=1'": array (1,3) =
acVp1_64in_1ft
the last
being an AutoCAD constant that may or may not apply, as I am using
some
scales that AutoCAD has no constant for.
At times I need to step through
looking for "768" to get "1/64" & Chr(34)
&
"=1'": or acVp1_64in_1ft, at other
times I am searching for "1/64" & Chr(34)
&
"=1'" to get "768" .
At this point I am
doing this with an array, and would like to use For
Each - Next rather than a
counter. Then again, maybe there is a better data
structure for what I am
doing?
I had thought about using a collection, but I suspect I will
eventually want
to populate the data structure from a file or database, and
as far as I can
tell, a collection requires hard coding to define. Again I
may be wrong.
Any help is GREATLY
appreciated!
Gordon
PS Sorry for the HTML post, but this was one
occation where that bold really comes in
handy!
occation where that bold really comes in
handy!