views:

145

answers:

3

I have a DataGridView with about 400 rows and 10 columns. When the user first displays this table, it receives all of the data from the server and populates the table. The DGV uses a DataTable as it's data source, and when updating the DataTable I use row.BeginEdit/EndEdit and acceptChanges, but when the View itself is updated it lags for a second while all of the DGV is being updated. I am wondering if there is a way to make this smooth, so that for example, if the user is scrolling through the data and it updates, it won't interrupt the scrolling. Or if the user is moving the display around the screen and it updates, it won't interrupt. Is there an easy way to do this? If not, is there away to prevent the DGV from updating the view until all events have ended so it won't be repainted until the user stops scrolling, dragging, etc ?

A: 

In the past I've found that slowness issues can be related to the auto-sizing properties. Here are some more ideas as well: Quick fixes for slow DataGridView

msergeant
A: 

The first idea that comes to my mind is to use a BackgroundWorker. Then, while your BackgroundWorker updates, it doesn't occupy the main thread, that is, your GUI thread.

Will Marcouiller
A: 

Try running debugger/profiler to determine which part is the actual cause for slow down. Once you figure out which line(s) are the culprit it will be easier to answer this question.

Robert