tags:

views:

454

answers:

4

Hi,

I just wanted to check with you guys if you know what the maximum number of rows - in a combo / list is. I know that VB6 had a 32k limit - I couldn't find anything to confirm with a quick google search so I thought I'd throw it out to the experts.

Cheers, Dave

+2  A: 

The maximum number of items should be around 2,147,483,647 in both .NET comboboxes and .NET listboxes.

But using a combobox with many items is perhaps not the best way of solving this issue, as it will be very hard to find and select the correct item in the combobox list.

Perhaps utilizing a single-select listbox, together with a connected edit field with wildcard searching could perhaps be a better solution.

dalle
You should note to the starter that this is the change from vb int types being 32bit not instead of 16bit like in vb6.The value is halfed due to it being a signed int (first bit is 1 for negative)
Tom Anderson
+1  A: 

It is by design only limited to available memory or 2^32-1 items. However, there's a bug in the Vista implementation of ListBox. Scrolling it gets screwy once you go past 65535 + one page worth of items. 65565 items when I quickly checked it. This bug bites also for ComboBox, the dropdown is a ListBox control.

This bug is rarely put to the test, one probable reason it didn't get fixed in Vista SP1. Nobody designs a UI that expects the user to be able to pick an item from that many choices.

Hans Passant
+1  A: 

Try using a series of combo boxes which would narrow down the search for the user, such as the first one might be items A-Z for example and then it would fill out the second one based upon the selection in the first.

Depending on the type of data you could catagorise through multiple combos

benPearce
+1  A: 

[It seems Matt Hamilton deleted his (first posted) answer where I commented about the maximum number of items (2^32 - 1) as others have now mentioned]

I echo the sentiment that putting a huge number of items in a list of any sort is probably not a good idea UI or otherwise, but if you really have to display a large number of items, don't forget to wrap the adding of items with a BeginUpdate and EndUpdate to prevent the drawing of items until the EndUpdate method is called.

Mitch Wheat