This is a continuation of this thread:
http://www.vbforums.com/showthread.php?t=538296
I was interested to see if sorting alphanumerically was the same as sorting by a characters ASCii code so I wrote the following code:
(to use it copy into a form containing a single list box)
And I found that up to 128 all the ascii values are in order, but then it gets a bit weird... anyone know why? I'm thinking it's got something to do with unicode but I don't know enough about it to fully explainCode:Private Sub Form_Load() Dim blnCharacterUsed(0 To 255) As Boolean Dim lngCurrentLowest As Long Dim i As Long Dim j As Long List1.Clear For i = 0 To 255 lngCurrentLowest = -1 For j = 0 To 255 If Not blnCharacterUsed(j) Then If lngCurrentLowest = -1 Then lngCurrentLowest = j Else If Chr(lngCurrentLowest) > Chr(j) Then lngCurrentLowest = j End If End If End If Next j blnCharacterUsed(lngCurrentLowest) = True List1.AddItem CStr(lngCurrentLowest) Next i End Sub![]()


Reply With Quote