I am using a BindingSource
control (reference here) to populate my DataGridView
control. There are around 1000+ records populating on it. I am using threading to do so. The DataGridView performs very slow in this case.
I tried to set DoubleBuffered
property to true, RowHeadersWidthSizeMode
to disabled, AutoSizeColumnsMode
to none. But still the same behavior.
Please assist me in this. How can I improve the performance of the Grid.
Thanks in advance,
Vijay
DataGridView works much faster if you prepare an array of rows and "feed" them to the AddRange() method of the Rows collection. Thus, a better version of our code could look like the following one: dataGridView1.
Max value, i.e. 2,147,483,647. The DataGridView's RowCount cannot hold a number more than this because it's an integer. So, you can possibly say that limit for datagridview rows is 2 Billion.
The DataGrid control is limited to displaying data from an external data source. The DataGridView control, however, can display unbound data stored in the control, data from a bound data source, or bound and unbound data together.
With virtual mode, you can manage the interaction between the DataGridView control and a custom data cache. To implement virtual mode, set the VirtualMode property to true and handle one or more of the events described in this topic.
If you have a huge amount of rows, like 10,000 and more, to avoid performance leaks - do the following before data binding:
dataGridView1.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.EnableResizing; // or even better, use .DisableResizing. Most time consuming enum is DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders // set it to false if not needed dataGridView1.RowHeadersVisible = false;
After the data is bound, you may re-enable it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With