Click to See Complete Forum and Search --> : Limit of ListBox
Tonatiuh
Dec 14th, 1999, 04:21 AM
ListBox has a limit of 64 KB.
What can I do if I need to store in my ListBox a list that has more than 64 KB?
Thanks!
MartinLiss
Dec 14th, 1999, 05:36 AM
Actually according to Help the maximum number of items is 32K.
Could you use multiple listboxes or perhaps a grid with one or more columns?
------------------
Marty
Tonatiuh
Dec 14th, 1999, 09:30 PM
I didn't use multiple listBox. The list must show in a single ListBox control.
Aaron Young
Dec 15th, 1999, 01:28 AM
Perhaps you could reduce the Character Length of the Items you're Listing to enable you to store more Items, ie. use Abbreviations
Then store the actual List in an Array and use the ListIndex property of the List to reference the Array to Display the Full Information when an Item is selected.
------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net
MartinLiss
Dec 15th, 1999, 03:03 AM
Aaron, unless I misunderstand what's in the help file, or the help file is wrong (which wouldn't be the first time), it's the number of items that is limited to 32K so abbreviations won't help. Here is what Help has to say:
Limitations for Particular Controls
The following table lists property limitations that apply to particular controls in Visual Basic.
Property Applies to Limitation
List and ListCount List box and combo box controls Maximum number of items is 32K; the limit on the size of each item is 1K (1024 bytes).
Tonatiuh, If you are limited to one listbox, one thing you could do is to only load the first 32K initially into the listbox, keep track of where the user is in the list, and if he/she is near the end of the initial list, delete, say, the first 1000 entries and add the 1000 that follow the initial 32K at the bottom, etc.
------------------
Marty
jkurpias
Dec 15th, 1999, 05:32 AM
ListBoxes are used to display data and for user selection. I can't imagine a user willing to work with 64,000+ items in a ListBox!
Where do the items come from? If they're not in a "easily usable" container, put them in an array or a recordset.
Allow the user to type the 1st few characters and display only the items that start with those characters.
-or-
Display 26 commandbuttons (in a control array) whose captions are the letters of the alphabet. The user clicks "B" and the prg displays all items starting with "B".
Doesn't anyone make custom controls for this kind of case? It seems that would be a worthy project.
Serge
Dec 15th, 1999, 06:13 PM
There are a lot of third party controls that has a limit in a Long size instead of Integer like native ListBox has, but they're all pricey. Anyway, take a look at the FarPoint's ListPro control. It allows you to add a Long number of items (which is more then 2 billion)
------------------
Serge
Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)
Joacim Andersson
Dec 15th, 1999, 06:31 PM
Can't you just use a ListView instead. It uses a Long instead of an Integer for the item index.
------------------
Joacim Andersson
joacim@programmer.net
joacim@yellowblazer.com
www.YellowBlazer.com (http://www.YellowBlazer.com)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.