This sounds like a theoretical question, but does anyone know the maximum items allowed in a listbox? (similar to a textbox's maxlength of 32767 characters)
I just ran the following code and stopped it myself (using breakpoint on the Add line).
Code:
While True
Try
ListBox1.Items.Add("test")
Catch ex As Exception
MsgBox(ListBox1.Items.Count)
Exit Sub
End Try
End While
At my final breakpoint the count was 1030625. It probably uses something like a collection or hashtable to store the items - in which case it would only be limited by memory.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.