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.
|