Click here to Skip to main content
15,886,860 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I have been populating a DataGridView programatically but as it's loading approx. 4500 records over 60 columns it's taking quite a while to load.

I looked at binding the DataTable, where my information is stored, to the DataGridView and it populates it much faster but then doesn't allow me to make changes to the DataGridView such as hiding certain columns or rows or changing text colour in certain cells.

What is the quickest and most efficient way of populating the DataGridView with all the data from my DataTable but still leave me access to manipulate the DataGridView afterwards without affecting the DataTable?

Thanks
Posted
Comments
Sergey Alexandrovich Kryukov 17-Jun-15 9:36am    
Nobody needs to see so many records at the same time. The whole idea to populate it fast with this volume of data is wrong. You need to implement, for example, paging of data. You can use virtual mode of DataGridView.
—SA

1 solution

Please see my comment to the question. The whole idea to populate it fast with this volume of data is wrong. So many records cannot be viewed at the same time, and no one needs to see them all. You can use different approaches to show only part of data which the user really needs to see. The data could be presented in response to some query requesting only some subset of data. Also, you can implement paging in virtual mode. Then you can start here:
https://msdn.microsoft.com/en-US/library/ms171622%28v=vs.80%29.aspx[^].

—SA
 
Share this answer
 
Comments
Member 11772864 29-Jun-15 9:46am    
Thanks for the reply. The reason I am loading all of the data at once is that it is a product list which needs to be browsed very quickly and has a number a filters available for the various columns as well as a text text search facility. Will all this be possible using the methods you have suggested?
Sergey Alexandrovich Kryukov 29-Jun-15 13:25pm    
This is not a valid reason for loading all at once. You can deplete the memory, that's all. But in virtual mode you can solve the problem. Yes, with filters, too.
—SA

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