Sorting Arrays 
Author Message
 Sorting Arrays

I need a function that can sort multi-dimensional arrays.  For example,
say I have the following type of array:

Dim TestArray(100,4)

This might represent 100 records each having four fields.  I might want to
sort this array on fields two and three, or just field 1 etc.  Does such a
function exist?

BTW, MSFlexgrid.Sort has been suggested but I don't want to use that.

Thanks very much.



Sat, 07 Jun 2003 21:51:06 GMT  
 Sorting Arrays
There isn't a pre-defined VB function to do it, no - you'd have to write
your own, or search the web.  I'm sure someone has written a
multi-dimensional sort routine out there somewhere.  You might have to
modify it to handle the multitude of sort parameters you need.

Using an MSFlexGrid isn't a bad idea, though - it's relatively painless,
outside of actually getting the data into the grid (which is more
time-consuming than hard).  Why are you rejecting that approach?
Considering how generic you would need your routine to be - handling arrays
of any dimension, with any combination of sort parameters - the speed
probably won't be that different, especially if you hide the grid (screen
updates are what generally take the longest).

Scott


Quote:
> I need a function that can sort multi-dimensional arrays.  For example,
> say I have the following type of array:

> Dim TestArray(100,4)

> This might represent 100 records each having four fields.  I might want to
> sort this array on fields two and three, or just field 1 etc.  Does such a
> function exist?

> BTW, MSFlexgrid.Sort has been suggested but I don't want to use that.

> Thanks very much.



Sat, 07 Jun 2003 23:28:12 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Sorting Arrays

2. Sort Array

3. Access 97: Sorting Arrays

4. sort array in vba

5. Sorting arrays - Excel97 VBA

6. Sorting Array

7. Sorting arrays

8. Sorting arrays in VBA

9. Sort Array

10. Sorting Arrays

11. Sorting array of structures

12. Sorting arrays

 

 
Powered by phpBB® Forum Software