Click here to Skip to main content
15,884,353 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Everyone
My application works with a large number of records.I used datatable to fetch data from the sql server. When setting the datasource property of the Datagridview as the datatable like below
C#
DataGridView1.DataSource=myDataTable

The Window is not responding till the datagridview filled with the records. I'm working with alteast of 5000 rows. Is there any way to do that without the screen hanging problem.


Thank You All
Posted
Updated 5-Jul-12 2:29am
v3

1 solution

Without reducing the number of records you're binding to, no. Since you can't touch a control in any way at all from a background thread, you have no choice but to put this operation on the UI thread, as you are already doing.

I think the answer is pretty obvious. Why are you putting 5,000 records in front of the user when they're not going to be looking through every single one of them?
 
Share this answer
 
Comments
Geo Jackson 5-Jul-12 23:38pm    
The records are colored with certain criteria . The user needs to check all the records and export it into Excel. There is no other way for me than showing whole records in DataGridView.
Dave Kreskowiak 6-Jul-12 17:03pm    
You're really making a user look at ALL 5,000 records?? That's insane!

How about summarizing the records into sets where the user doesn't have to pickout different colors (which also slows down your grid!) but can look through suspect records instead.

The point is if the data is known-good in your code, don't show it to the user. Show them the stuff that actually needs to be inspected.
Geo Jackson 16-Jul-12 2:59am    
Coloring process is in another thread . After viewing records the color processing begins , no issue in coloring . Exporting is the main thing .after verifying records we need to export the data into excel.and already i'm showing records in summarized manner, we have certain categories , i'll show records by user's choice , they have to select the criteria
Geo Jackson 16-Jul-12 3:00am    
Thanks for your comment,

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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