Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Need Help Sorting Things in a Table

Hello
I am having some trouble sorting things by number in a table. I was wondering if anyone could direct me to a Public Function that would work for it. I have one that sorts by time in one table, but i also need one that sorts by an user inputed number in a seperate table. The time code is this:

Public Function Sort1()
Dim i As Integer, z As Integer, n(7)
With Active.lst1
For i = 1 To .ListItems.Count
DoEvents
For z = 1 To .ListItems.Count - 1
t = FormatDateTime(.ListItems(z).Text, vbShortTime)
b = FormatDateTime(.ListItems(z + 1).Text, vbShortTime)
If t > b Then
t = FormatDateTime(t, vbLongTime)
b = FormatDateTime(b, vbLongTime)
n(0) = Left$(t, Len(t) - 6) & Right$(t, 3)
.ListItems(z).Text = Left$(b, Len(b) - 6) & Right$(b, 3)
.ListItems(z + 1).Text = Left$(t, Len(t) - 6) & Right$(t, 3)
For y = 1 To 6
n(y) = .ListItems(z).SubItems(y)
.ListItems(z).SubItems(y) = .ListItems(z + 1).SubItems(y)
.ListItems(z + 1).SubItems(y) = n(y)
Next y
End If
Next z
Next i
End With
End Function

So I was wondering if anyone had one that would work for sorting numbers.
[1301 byte] By [Mister Purple] at [2007-11-11 10:03:24]
# 1 Re: Need Help Sorting Things in a Table
the same function !
numbers are stored in lst2 say ? change "With Active.lst1" to "With Active.lst2"
and don't use "FormatDateTime()" function : just ".ListItems(z).Text"
many lines must be removed too which was puted for time ..
Amahdy at 2007-11-11 17:23:19 >