Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends, I have a huge data which i want to bind in datagridview for view purpose but as the data is large the form on which the data gets bind to datagridview gets hanged for sometime and hence the user have to sit idle for the time.

E.g. I have 500 entires (may increase unto multiples of 1000) then it takes around 15-20 seconds for the data to get bind to datagridview.

Is there any way to reduce this time because in order to bind the same we have to run a foreach() loop unto the no of entries present?

Thanks in advance
Posted

If your client requires all data in one hit and to still have response from the application then the only methodology that springs to mind is multi-threading.

Load the data in a thread other than the application thread.

Here[^] is some initial reading, in case you are not familiar with the subject. I have to say that I have never really got this to work satisfactorily, although I was only trying it out, not doing it for real.

Good luck! :)
 
Share this answer
 
Comments
Varun Sareen 16-Jul-10 3:45am    
Reason for my vote of 5
You are right Henry. Thanks for the answer. :)
Paging Data with DataGridView in VirtualMode[^] might help.

There is also a large section on MSDN on the same subject.

Good Luck! :)
 
Share this answer
 
Comments
Varun Sareen 11-May-10 1:47am    
Thanks Henry, But my client requires no paging stuff. All Data at one go. If you have some other good idea then plz let me know
I think you should restrict the number of rows[ set rowcount] to be fetched from the database by writing proper select queries.
For further study:
http://www.devx.com/getHelpOn/10MinuteSolution/20564
 
Share this answer
 
Comments
Varun Sareen 10-May-10 3:57am    
I appreciate your answer dear Avish but the problem here is that i can't reduce the number of rows to be fetched from data. If the user is selecting a particular node in TREE VIEW then all the records related to that node must be visible to user. Otherwise the process might go wrong. :)
Varun Sareen 22-Jun-10 7:46am    
Reason for my vote of 1
i cant restrict the no of rows because the amount of data present in database is huge in number and the requirement is to fetch all the data at one go.
I reduced much of the time with the help of delegates.
 
Share this answer
 
Comments
nareshkumar464 25-Jul-13 9:00am    
Hi,
I wrote a seperate function to fetch the data from database and fill the datagridview. I called the function in seperate thread.My dataset contains 10 tables in which each table contains approximately 15000-20000 records,while assigning datatable to datagridview,it is taking too much time approximately 10-15 secs.can anyone help me?Thanks in advance........
CHill60 25-Jul-13 13:52pm    
If you have a question of your own then use the "Ask a question" link to post it. You are likely to get a better response that way than posting a comment to a 3-year old "solution". Remember to include your code when you post the question.
Varun Sareen 7-Aug-13 0:40am    
yes

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