让我看看我能想出什么 谢谢
'fill MyArray
For i = 1 To UBound(ComboBox1.List)
MyArray(i) = ComboBox1.List(i)
Next i
QuickSort MyArray, LBound(MyArray), UBound(MyArray)
ComboBox1.Clear
'use sorted array to refill ComboBox
For i = 1 To UBound(MyArray)
If MyArray(i)"" Then _
ComboBox1.AddItem MyArray(i)
Next i
Private Sub QuickSort(strArray() As String, intBottom As Integer, intTop As Integer)
Dim strPivot As String, strTemp As String
Dim intBottomTemp As Integer, intTopTemp As Integer
intBottomTemp = intBottom
intTopTemp = intTop
strPivot = strArray((intBottom + intTop) \ 2)
While (intBottomTempintBottom)
intTopTemp = intTopTemp - 1
Wend
If intBottomTemparr(Index + 1)) Xor descending Then
' if the items are not in order, swap them
arr(Index) = arr(Index + 1)
arr(Index + 1) = Value
lastSwap = Index
End If
Next
Loop While lastSwap
End Sub
页:
1
[2]