473,506 Members | 17,266 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Fill List box fast!!

Hi,

I want to fill my list box from a dataset in c#.
I use adapter and fill command and bind it to a listbox, but it is very slow
for large data about 500000 records.
How can I view this list rapid?

thanks.
Nov 15 '05 #1
3 12030
Consider adding the ability to "page" thru' your data. 500,000 records
is beyond being usable to a person.

Use paging and some well-thought-out search routines rather than
tossing all the data at the user and praying for results.

PS... 500,000 rows will take time no matter what you're doing.

If you *MUST* have those 1/2 millions rows available in a GUI (truly
doubt it), then fill the list box on a thread and use the async
methods available to the ado.net libraries.

Again, I suspect you're just using a poor design model. Humans simply
WON'T deal with 500000 choices in a listbox.

"ali poursadri" <ap*******@noornet.net> wrote in message news:<u2**************@tk2msftngp13.phx.gbl>...
Hi,

I want to fill my list box from a dataset in c#.
I use adapter and fill command and bind it to a listbox, but it is very slow
for large data about 500000 records.
How can I view this list rapid?

thanks.

Nov 15 '05 #2
Ali,

In addition to Chris' well thoughtout comments if you really do need to
display all of those records you can either hide the listbox till it is
full or use SuspendLayout/ResumeLayout
(http://msdn.microsoft.com/library/de...-us/cpref/html
/frlrfsystemwindowsformscontrolclasssuspendlayoutto pic.asp) to prevent
spending time painting the control while it is being updated.

Thanks! Robert Gruen
Microsoft, VB.NET

This posting is provided "AS IS", with no warranties, and confers no rights.

--------------------
| From: ch***@chornbe.com (Chris Hornberger)
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Subject: Re: Fill List box fast!!
| Date: 15 Sep 2003 07:05:44 -0700
| Organization: http://groups.google.com/
| Lines: 24
| Message-ID: <53**************************@posting.google.com >
| References: <u2**************@tk2msftngp13.phx.gbl>
| NNTP-Posting-Host: 63.118.189.214
| Content-Type: text/plain; charset=ISO-8859-1
| Content-Transfer-Encoding: 8bit
| X-Trace: posting.google.com 1063634744 9708 127.0.0.1 (15 Sep 2003
14:05:44 GMT)
| X-Complaints-To: gr**********@google.com
| NNTP-Posting-Date: 15 Sep 2003 14:05:44 GMT
| Path:
cpmsftngxa07.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTN GXA05.phx.gbl!TK2MSFTNGP08
.phx.gbl!newsfeed00.sul.t-online.de!t-online.de!news-spur1.maxwell.syr.edu!n
ews.maxwell.syr.edu!cyclone.bc.net!sjc70.webusenet .com!news.webusenet.com!pd
2nf1so.cg.shawcable.net!residential.shaw.ca!sn-xit-03!sn-xit-01!sn-xit-09!su
pernews.com!postnews1.google.com!not-for-mail
| Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.languages.csharp:184216
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| Consider adding the ability to "page" thru' your data. 500,000 records
| is beyond being usable to a person.
|
| Use paging and some well-thought-out search routines rather than
| tossing all the data at the user and praying for results.
|
| PS... 500,000 rows will take time no matter what you're doing.
|
| If you *MUST* have those 1/2 millions rows available in a GUI (truly
| doubt it), then fill the list box on a thread and use the async
| methods available to the ado.net libraries.
|
| Again, I suspect you're just using a poor design model. Humans simply
| WON'T deal with 500000 choices in a listbox.
|
| "ali poursadri" <ap*******@noornet.net> wrote in message
news:<u2**************@tk2msftngp13.phx.gbl>...
| > Hi,
| >
| > I want to fill my list box from a dataset in c#.
| > I use adapter and fill command and bind it to a listbox, but it is very
slow
| > for large data about 500000 records.
| > How can I view this list rapid?
| >
| > thanks.
|

Nov 15 '05 #3
the fastest way to add something to listview is through AddRange method
(maybe faster would be to use datareader instead of dataset since you need
to
create listview items one by one and then pass a collection to method).

Adding cca 5000 items,each with 12 subitems, with two calculations per item
and using rather complex sql query takes about 0.6seconds on my Athlon900.
Without AddRange it takes about 1 minute (adding item one by one

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
2868
by: Neil | last post by:
I have a very puzzling situation with a database. It's an Access 2000 mdb with a SQL 7 back end, with forms bound using ODBC linked tables. At our remote location (accessed via a T1 line) the time...
19
3962
by: Alex | last post by:
Hello list This question has probably already been asked, but let me ask again I have a mysql database to which I connect with my php scripts. The database contains articles. Name, Unit_Price...
9
1629
by: lars_woetmann | last post by:
I have a list I filter using another list and I would like this to be as fast as possible right now I do like this: i tried using the method filter: filter(lambda x: x not in list2, list1)
3
2062
by: Senna | last post by:
Hi Have these to work with. int counter = 0; //The total item to fill the collection with int increment = 2; //Any number int current = 244; //Quantity int max = 1290; //Max Quantity int...
10
2972
by: javuchi | last post by:
I just want to share some code with you, and have some comments and improvements if you want. This header file allocates and add and delete items of any kind of data from a very fast array: ...
5
11274
by: buntyindia | last post by:
Hi, I have three Listbox on my jsp page. I want to do following: ByDefault first list will be filled by database, When User select something from 1st list box second will fill accordingly ...
1
2340
by: Mahesh | last post by:
Hi Coders, I was asked to write a program to interchange numbers using doubly linked list @ Amazon. Here is the details with Code that i wrote. i/p: 1 2 3 4 5 6 7 8 .....n,n-1. o/p: 2 1 4...
5
1537
by: buddyr | last post by:
Hello, first problem I am having creating this database is: Can I create a combo box to select different tables to display in list box? 3 tables tblGuitar, tblPercussion, tblKeyboards I want...
3
4347
by: semomaniz | last post by:
I have a ajax reorderlist that displays the contents with out any problems but when i drag and reorder the list nothing happens, i get a postback and the same initial list is displayed, seems like my...
0
7105
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7371
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7023
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5617
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5037
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3178
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
410
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.