Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listbox maximum items 1

Status
Not open for further replies.

jecairns

Programmer
Oct 5, 2005
21
CA
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)

Thanks in advance,
JC
 
Well - I'm not sure - it doesn't appear so.

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.
 
Thank you very much-what a simple way to test it-my brain must not be working today.

JC
 
That happens to everyone jecairns - glad I could be of assistance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top