|
-
Feb 26th, 2003, 08:13 AM
#1
Thread Starter
Member
ListBox Size Limit - Any Way To Increase It?
Hi,
I have about 43000 items I need to display in a listbox. I add all the items to the listbox by using a loop like so...
VB Code:
arraypos = 0
Do While (arraypos < 43000)
List1.AddItem("File " & arraypos)
arraypos = arraypos + 1
Loop
When the arraypos number reaches 32736, VB returns the following error message "Invalid procedure call or argument" - which is runtime error 5
The error highlights the line which adds the text to the list
The program works perfectly fine when I limit the number of times it does the loop to a number less than 32736
ie. Do While (arraypos < 32736)
I presume that there is a limit on the number of items allowed in a listbox. Is there any way I can increase the limit on the listbox to a higher number?
Thanks guys.
WATTO
[email protected]
http://www.watto.org
"There is no such thing as a coincidence" - Tegan Sneddon 2002
-
Feb 26th, 2003, 08:18 AM
#2
Sorry, the listbox control is limited in the amount of items it can hold. Try a Listview instead. Its limited only by available memory.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Feb 26th, 2003, 09:05 AM
#3
Frenzied Member
Listbox.Listindex is an Integer and therefore cannot take more than maximum allowed. Integer can hold upto 32,767 but since ListIndex is ZERO based - the upper bound is 32,766 and there is no way arround.
What you may do is use an array but display in the Listbox part of it (let's say 100 entries). It's very simple to implement. Also loading more than few hundred recorrds in the list isn't reasonable anyway - no one will be looking through so many of them.
-
Feb 26th, 2003, 09:15 AM
#4
Originally posted by McGenius
Also loading more than few hundred recorrds in the list isn't reasonable anyway - no one will be looking through so many of them.
seriously.. if i was using an application.. and a listbox had 40k+ entires for me to choose from... i would want to shoot the programmer there should be some way of limiting it... what does the listbox contain that someone would have to pick from so many?
-
Feb 26th, 2003, 09:21 AM
#5
Frenzied Member
Originally posted by kleinma
seriously.. if i was using an application.. and a listbox had 40k+ entires for me to choose from... i would want to shoot the programmer there should be some way of limiting it... what does the listbox contain that someone would have to pick from so many?
LOL, indeed ...
-
Feb 26th, 2003, 05:28 PM
#6
Thread Starter
Member
Yeah, I know, 40000 files is a lot to sort through 
The program I am making is an archive reader - kinda like winzip. My program opens *.dat archives (used by Maxis) and writes the file names of each entry in the archive into the listbox. It just happens that 1 archive I an trying to display has 40000+ files in it.
I was thinking of splitting the array in half, but only if there wasn't any other way to display them all at once.
Oh, and what is that ListView thing, and how is it used?
Thanks guys.
WATTO
[email protected]
http://www.watto.org
"There is no such thing as a coincidence" - Tegan Sneddon 2002
-
Feb 26th, 2003, 05:54 PM
#7
You could also consider having an A-B-C-D set of selection buttons (as a control array) and split your listbox into a control array of 26 listboxes. They could all be placed on top of each other with all but the "A" listbox set to hidden, and then you could simply make the proper listbox visible depending on which of the A-B-C-D buttons was pressed.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|