Just give us an example list of files and then the list of how you want them
sorted.
Also include the code you use to extract the list of files.
Mike
"Driver, Nicholas" <[EMAIL PROTECTED]> wrote:
Hi everybody
After my hassles last week trying t get a list of files from an FSO into an
array, I've set up a bubblesort (copied code form 4guysfromrolla) but can't
work out how to sort in descending order. Here is the code:
'=========================
'Sort Array
Sub SingleSorter( byRef MyArray )
Dim row, j
Dim StartingKeyValue, NewKeyValue, swap_pos
For row = 0 To UBound( MyArray ) - 1
'Take a snapshot of the first element
'in the array because if there is a
'smaller value elsewhere in the array
'we'll need to do a swap.
StartingKeyValue = MyArray ( row )
NewKeyValue = MyArray ( row )
swap_pos = row
For j = row + 1 to UBound( MyArray )
'Start inner loop.
If arrArray ( j ) < NewKeyValue Then
'This is now the lowest number -
'remember it's position.
swap_pos = j
NewKeyValue = MyArray ( j )
End If
Next
If swap_pos <> row Then
'If we get here then we are about to do a swap
'within the array.
MyArray ( swap_pos ) = StartingKeyValue
MyArray ( row ) = NewKeyValue
End If
Next
End Sub
SingleSorter MyArray
'=========================
Any suggestions would be great. I'd actually prefer some hints and pointers
to help me learn than a complete solution 'out of the box' so to speak.
cheers
Nick
--------------------------------------------------------------------------------
This E-Mail is intended only for the addressee. Its use is limited to that
intended by the author at the time and it is not to be distributed without the
author's consent. Unless otherwise stated, the State of Queensland accepts no
liability for the contents of this E-Mail except where subsequently confirmed in
writing. The opinions expressed in this E-Mail are those of the author and do
not necessarily represent the views of the State of Queensland. This E-Mail is
confidential and may be subject to a claim of legal privilege.
If you have received this E-Mail in error, please notify the author
and delete this message immediately.
--------------------------------------------------------------------------------
!DEPTSTAMP1!
---------------------------------
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
[Non-text portions of this message have been removed]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/