Rex
Rex

Reputation: 39

How to increase the number of contents to be stored on a listbox in c#

I'm trying to store huge amount of data on a listbox. For example, i was about to store more than thousand of words on a listbox, suddenly it stopped accepting inputs on the collection.

Is there any way to increase the limit of contents to be stored on a listbox in c#?

Upvotes: 1

Views: 152

Answers (2)

cdkMoose
cdkMoose

Reputation: 1636

Virtualizing listbox is the correct technical answer. However, I think the more important question is Why, not How. IMHO, in a practical sense, a listbox with 1000+ items is unusable in almost all cases. How will a user remember the choices they have seen or selected as they scroll further into the 1000+ items?

You and your users might be better served by posting a question on the sibling site here at StackExchange, User Experience. There you might ask for the best way to present a very large number of choices to a user.

Upvotes: 1

Ricibob
Ricibob

Reputation: 7705

In WPF the ListBox control is a virtualizing listbox - in that it only holds in memory whats currently in view in the control. That makes it able to handle very large backing data collections. Its not clear whether your in WPF or forms - if in forms maybe you need to look at a virtualizing listbox.

You might try something like: this that appears to be a winforms compatible listbox built using wpf (so will probably be virtualizaing) - why not ask them about large data sets.

Upvotes: 0

Related Questions