VB-Tips
2 messages in this thread
Nelson:
While reading your latest updated VB-Tips, two of the subjects, "Slow
loading of Combo Boxes" and "Capacities", reminded me of a some of my
recent observations while trying to get Combo Boxes to load faster:
– Using the API call CB_ADDSTRING appears to be 5-10 times
faster than using the AddItem method.
– When loading a Combo Box with CB_ADDSTRING, the speed difference
compared to loading a List Box is very minimal (For List Boxes, the API
call LB_ADDSTRING is actually slightly slower for some reason). Loading
5000 strings with each (on a slow 386SX-16) came out to this:
List.AddItem LB_ADDSTRING CB_ADDSTRING
———— ———— ————
25.6 seconds 26.4 seconds 29.9 seconds
– When running these tests, I originally tried loading 10,000
strings, but each time both the combo boxes and list boxes would bottom out
at 5440. Try this:
For I = 1 to 10000
List1.AddItem Str$(I)
Next I
It will stop at 5440. Even when only adding a single character
(List1.AddItem "A") the List1.ListCount will stop at 5440.
Why would it only hold that many lines when the capacity is supposed to be
around 64k? Now I'm really confused…
…Bill
I get the same result. List and Combo boxes must have a limit of 5440
lines, as well as 64k. I wonder if this is documented anywhere.