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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How many items can a Combo Box have?

Status
Not open for further replies.

vikramonline

Programmer
Oct 14, 2003
186
IN
I have a Combo Box which gets populated from the database table,which has around 35000 records.
Problem comes when loop has finished 32736 iterations.
I get RUNTIME ERROR 5.

Just for cross checking I started with a new Standard Exe with a Combo Box in it.When I try to populate the Combo Box with more than 32736 items I get the same error.

Am I doing something wrong ? Please suggest.
 
Integers have a maximum of 32767, which is quite close to your error number. Is the combo populated with a loop which counts an integer ie for i=1 to 35000, where i is declared as an integer? If so, change the declaration to i as long. It may be that the combo is declared within its own code as having a maximum of integer entries only, rather than long.

BB
 
No, thats about right.
You'll find that limit all over the place - scroll bar max values for instance.

The limiting factor is (for some reason), the maximum value of a 16 bit integer.
In Hex: FFFF, or 65536 decimal
Treat this as a signed integer, and you get values of
-32766 to + 32767 (or thereabouts)

This can be frustrating, but you have to ask if the user will actually want to wait for the combo to fill with this number of items, or if they will want to scroll through that many to find an item they want.

In general:
When you get to this volume of data, it is usually better to allow free text input into a text box, and provide a search button next to it, so that the user can search for the item they want.
 
Thanx All

BiggerBrother,
It does not help even if u change the counter to double.

Jefftullin,
Ur suggestion is really good.Although having a search button will completely change my interface,but at the same time is a good way to be ERROR FREE.
 
A combo box's proper usage can be questioned if you are trying to put that many items into it.
 
>The limiting factor is (for some reason)

Legacy, from the days of VB4-16bit and earlier. It can be annoying on occassions, since the Windows controls that underly the VB controls generally don't have the same limitations
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top