Click here to Skip to main content
15,889,595 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Current in my situation my listbox has 75000 items and on scroll i am setting the topindex value on scrolling event. But after storing more than 65536 it comes back to starting point. As ListBox.TopIndex datatype is Int so again it is setting topindex starting from zero but i need to store 70000 or 75000 in this to set the top index as my listbox contains more than 70000 items.

Is it possible to set this?
Posted
Updated 4-Dec-15 1:28am
v2
Comments
phil.o 4-Dec-15 7:39am    
You may be surprised by the number of people who will refuse to use a program that presents them with 70k different items at the same time.
IMHO, you have a design issue.
Vikrant_Mishra 4-Dec-15 7:51am    
yeah thats right, but this is the requirement, for that we have textbox which filter listbox with character inserted to textbox. But this situation looks bug when user scroll down the listbox it scrolls back to starting point as topindex goes off to max limit of Int Datatype.. Please help if its posible
phil.o 4-Dec-15 8:00am    
The ListBox is limited to a given amount of data by design, for good reasons.
You should use filtering and paging.
And the max value of int type is far more than 65536; it is exactly 2^31 - 1 = 2,147,483,647. So the datatype of the TopIndex is not what is limiting the number of items. Implementation of ListBox is what is limiting the number of items.
If the requirement really is 'having 70k different items presented to user at the same time', then this is the requirement that is flawed.
Let me make an analogy with a car: if you had a requirement to build a (usable) car with square wheels, would it seem reasonnable to you?
Again, that much data in a single screen is insane.
CHill60 4-Dec-15 8:03am    
This is so the solution! A virtual 5
Vikrant_Mishra 4-Dec-15 8:08am    
ROFL, Nice example Phil. Thanks for your explanation.

1 solution

I did not find any usable hint for paging a Windows Forms ListBox.
But, I found this article in on CP that deals with paging a ListView (which is not a huge change in the design):
Listview Paging in C#[^]

A 'Windows Forms ListBox paging' Google search gives some other results, too. Maybe one of them is worth browsing.

Hope this helps. Good work :)
 
Share this answer
 
Comments
Matt T Heffron 4-Dec-15 12:28pm    
+5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900