Bob Schneider
asked on
VB Array Sort Question
I have a vb classic two-dimensional array called Arr(2, i). It is currently sorted by the third element (index 2). I want to sort it by the first element (index 0) and then keep it sorted within index 0 by index 2. In other words, if the array consisted of:
Arr(0, 0) = 1
Arr(1, 0) = x
Arr(2, 0) = 100
Arr(0, 1) = 2
Arr(1, 1) = x
Arr(2, 1) = 200
Arr(0, 2) = 1
Arr(1, 2) = x
Arr(2, 2) = 300
Arr(0, 3) = 2
Arr(1, 3) = x
Arr(2, 3) = 400
I would like it to be sorted into this:
Arr(0, 0) = 1
Arr(1, 0) = x
Arr(2, 0) = 100
Arr(0, 1) = 1
Arr(1, 1) = x
Arr(2, 1) = 300
Arr(0, 2) = 2
Arr(1, 2) = x
Arr(2, 2) = 200
Arr(0, 3) = 2
Arr(1, 3) = x
Arr(2, 3) = 400
Arr(0, 0) = 1
Arr(1, 0) = x
Arr(2, 0) = 100
Arr(0, 1) = 2
Arr(1, 1) = x
Arr(2, 1) = 200
Arr(0, 2) = 1
Arr(1, 2) = x
Arr(2, 2) = 300
Arr(0, 3) = 2
Arr(1, 3) = x
Arr(2, 3) = 400
I would like it to be sorted into this:
Arr(0, 0) = 1
Arr(1, 0) = x
Arr(2, 0) = 100
Arr(0, 1) = 1
Arr(1, 1) = x
Arr(2, 1) = 300
Arr(0, 2) = 2
Arr(1, 2) = x
Arr(2, 2) = 200
Arr(0, 3) = 2
Arr(1, 3) = x
Arr(2, 3) = 400
Is this really a 'sort' problem? The example seems to simply interchange some values. Can you explain the general rules, please?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
How big is the actual array?