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:
  1. arraypos = 0
  2. Do While (arraypos < 43000)
  3. List1.AddItem("File " & arraypos)
  4. arraypos = arraypos + 1
  5. 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