Anya
Anya

Reputation: 11

data grid view is slow

I have a data grid view which is constantly being updated. It doesn't perform the way i would like it to.

Can you guys suggest any alternative controls which you think are gonna handle updates faster?

Thanks.

////////////

no binding. when i use datasource its even worse.

i update an element like DepthGridBid.Rows[i].Cells[j].Value = .. i and j indexes i know from update that i receive.


implemented virtual mode. compared to older version. measured timing. it is not faster.

Do you guys know any other options?

Thanks!

Upvotes: 1

Views: 2227

Answers (3)

D. Herzog
D. Herzog

Reputation: 66

You also have to query the data just in time.
please look at this

Upvotes: 0

Oliver
Oliver

Reputation: 45119

Just to get the most performance out of the DataGridView you should also take a look into the DataGridView FAQ.

Upvotes: 0

vgru
vgru

Reputation: 51282

If you don't want to bind the data, and your data is changing rapidly, then virtual mode should work for you.

 // set the VirtualMode property to true
 dataGridView.VirtualMode = true;

 // handle the CellValueNeeded event
 dataGridView.CellValueNeeded += new
    DataGridViewCellValueEventHandler(dataGridView_CellValueNeeded);

If your data length is always the same, you only need to setup rows and columns once, and then only call Invalidate() when you receive new data, to inform DataGridView that it needs to repaint.

Upvotes: 2

Related Questions