Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy string array to Combobox list 1

Status
Not open for further replies.

paulbent

Programmer
Mar 4, 2002
1,071
GB
Is there a way using API functions to populate a VB combobox list from a string array?

A combobox in another product I program with has a SetList method which does this. It's way faster than AddItem.

Paul Bent
Northwind IT Systems
 
I was browsing Devx just yesterday and saw this.




"Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'."
 
The Forms 2.0 combobox can be populated straight from an array...
 
Thanks for the link, I'll check it out tomorrow and do some time comparisons.

I see the example uses SendMessage to add the items one at a time. I was wondering if there is a way to copy the array in one go.

Paul Bent
Northwind IT Systems
 
Strongm,

Thanks but I want to be able to port the solution to a LotusCombobox in another environment. It's very similar to a VB combobox and the development environment is similar to VBA. If I can get something working with a VB combobox I should be OK in Lotus.

Paul Bent
Northwind IT Systems
 
DrJavaJoe,

Thought you might be interested... I tested with SendMessage and it was way faster. Loading 6,500 customer names into an unbound LotusCombobox from a recordset took:

AddItem with combo visible: 15.03 secs
AddItem with combo invisible: 10.08 secs
SendMessage: 1.79 secs

Not bad eh? Thanks!

Paul Bent
Northwind IT Systems
 
Impressive, good to know.

"Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top