Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

What to do to speed up datagridview population?


Asked by Elianna Hahn on Dec 02, 2021 FAQ



After the data is bound, you may re-enable it. Generally turning auto-sizing off and double buffering help to speed up DataGridView population. Check whether the DGV double buffering is turned on properly:
Moreover,
The fastest way to populate an instance of the DataGridView control is to use data binding through its DataSource property. In the simplest case you can prepare your data by putting them into an ADO.NET DataTable and display it very fast using a statement like this:
Additionally, DataGridView loads slow if you use a dataset or table as it's datasource. You should use a datasourceview and it will be much faster. Manipulating the datagridview in any way graphically is super slow. Turning off events and layout doesn't help with this speed problem.
In addition,
When working with large amounts of data, the DataGridView control can consume a large amount of memory in overhead, unless you use it carefully. On clients with limited memory, you can avoid some of this overhead by avoiding features that have a high memory cost.
Likewise,
If you do not need 2-way data-binding or some features provided by BindingSource (filtering, etc.), you may consider adding rows at one go with the DataGridView.Rows.AddRange () method. The link to the source article with the sample: http://10tec.com/articles/why-datagridview-slow.aspx Make sure u don't auto-size columns, it improves performance.