maximum items allowed for vb6 list/combo box ?

Posted on 2006-06-05
Last Modified: 2013-12-25
about 32700 items allowed to be added, just like to confirm, right figure ?

Question by:Fiacre
    LVL 8

    Assisted Solution

    Fiacre, while I can not find anything that shows an exact number on the combo box, I can assure you it is greater than 32,700.
    I assume that the maximum is based upon the memory of the computer.  From what I have seen there is no 'reliable' source
    which states an actual amount that I am aware.
    LVL 8

    Expert Comment

    Fiarce, the only limit I have been able to find on this subject is two million.  I have took it upon myself to test this limit.
    With my testing I have been able to tell that it is in fact false.  I have been able to get a combo box up to 3 million members.
    With this test I am almost certain it is based upon memory.

    As for list boxes, I have again been able to find unofficial/unbacked guesses on their limits.  Again, I have been able to prove these
    limits of 32768 and 65536 to be false.  I have a listbox in VB6 Service Pack 6(As with the Combo test) to hold 500,000 values, this
    was not the limit, just where I stopped the test, again I would guess this is also based on memory.
    LVL 8

    Expert Comment

    Okay, I ran a 3 million test on the listbox and it succeeded as well.
    LVL 13

    Expert Comment

    From a technical perspective, the limit may be quite high, as List244 stated.

    From a usability perspective, lists and combos with more than a couple hundred items are going to be a real pain.

    You might want to look at ways of filtering and categorizing your content so that the list sizes are more manageable, from both perspectives.


    LVL 6

    Accepted Solution

    Not indending to hijack this thread, but just expressing a curiosity, List244...
    I don't doubt that you can populate a listbox with ListboxCtrl.Add dummydata with millions, but is the box actually usable in your tests?  Even the object browser looking in the VB library at the Listbox  shows clearly that several properties (index, listindex, selcount, selected() ) are integer based.  I just populated a lsitbox with 1-40000 and have a button print out the listindex on command when I've selected an entry, but the properties return (instead of crashing, surprisingly enough) distorted numbers.  
    etc etc

    So a question would be how usable the listbox would be above the integer limits, with the integer based functions returning different results.  What is the lixt index for the 1 millionth entry?  If you try setting the List1.TopIndex to 39900, it generates an overflow error...  Curisosity now, a million entries, I see with 40000 my numbers going from 32767 to -32768.  What happens when it gets back to -3, -2, -1.  Since -1 is 'reserved' for "not selected", does it happen?  What happens after -1 if it rolls through again?  Surely, the system is working with larger numbers, but VB is only able to see the integer bytes of it, so does it oscillate?

    So populating a listbox with above 32xxx and having it actually work with that many are different stories.  Indeed, it is almost odd that it doesn't internally crash out at that limit, but allows itself to be overstuffed until you explicitly need to work with setting the parameters beyond integer limit, or grabbing them, since you would have expected it should have.  Clearly, populating the listbox (without indices) has no touching effect on its integer components, and thus is like a buffer overrun visualization....

    Now returning control of this thread :)
    LVL 8

    Expert Comment

    GPrentice, that is a good point, I guess it really depends on what use the listbox will be.  If it is simply for viewing purposes
    it would be alright, if you actually need data, you are right, it will not return.  However, with a combo box.. that is slightly different.
    While the same problem will arise with the index, you can still grab the text of it.
    LVL 12

    Expert Comment

    The intrinsic ListBox control in VB6 is limited to a maximum of 32,767 items, which is the maximum storage size for an "Integer" data type.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
    Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now