How to update only visible rows of DataGridView data bound?

I have a DataGridView associated with a list of custom objects created on the fly. This list is not very large, with a maximum of 5000 items. However, the values ​​of the custom objects change every 50 ms, and the grid freezes when the values ​​are updated and ultimately fail.

My question is: is there a way to “virtualize” the data binding to the DataGridView so that only those rows that are actually visible on the screen are updated?

EDIT: I found out why my DataGridView was so slow and had nothing to do with data binding. Therefore, this issue is no longer relevant. As a side note, I think the DataGridView already updates only the visible rows when the ListChanged event ListChanged .

+4
source share
4 answers

Good article on virtual mode (DataGridView). - http://www.codeproject.com/KB/books/PresentDataDataGridView.aspx#7

+2
source

A lot of time passed trying to find this problem, and this question continued to appear, so I will link here the answer that solved my problem: fooobar.com/questions/1289177 / ...

I have a DataGridView associated with a BindingSource, which is also associated with ComboBoxes and TextBoxes, which are used to edit data. Each Leave event on the editors had a big lag caused by the DataGridView redrawing all the rows when the data was updated. This happened even when using VirtualMode.

The problem was caused by installing AllSells to automatically configure the columns of the DataGridView. Each time the value changed, the DataGridView scanned all rows to find the longest row for auto-negotiation of the column. After disabling autosave, I realized that even a DataBridView of data binds only visible rows, so there is no need to use VirtualMode.

+1
source

I think you might want to peek in using a DataGridView in virtual mode .

0
source

What prevents you from simply pulling a visible subset of elements instead of just 5000?

0
source

All Articles