如何对组合框排序?
有没有办法按字母顺序对组合框排序作者未知Public Function CBsort(CB As ComboBox)
' Sort the Combobox
Dim CBvar As Variant
For I = 0 To CB.ListCount - 2
If CB.List(I) > CB.List(I + 1) Then
CBvar = CB.List(I)
CB.List(I) = CB.List(I + 1)
CB.List(I + 1) = CBvar
I = -1
End If
Next I
End Function
谢谢你的代码
只有这需要很长时间才能对90.00000个项目中的列表进行排序 在将信息添加到组合框之前对其进行排序 ;什么';你的代码看起来像什么 ;你能发一个片段吗? 将项目读入数组、对数组排序然后将数组添加到组合框中可能更容易/更快
有多少?? http://vbnet.mvps.org/index.html?code/sort/qsoverview.htm快速排序可能是其中之一,但肯定需要几秒钟的时间
有多少
没错
为什么你想/需要在一个组合框中添加9000000个项目 简单的解决方案是在设计时在IDE中将Sorted属性设置为True
在运行时,组合框排序属性是只读的,因此需要在运行代码之前对其进行设置。
但VBA中的组合框不';没有排序选项。(除非它被称为其他东西??)
页:
[1]
2