DataGridView Virtual Mode

0
0

Hi I’m working with the datagridview in virtual mode and I have a background timer that is checking for database changes and if it finds changes to update the row/cell with the changes.

Right now I am just doing cell[i].Value = {new value from db}

It never updates the ui. I’ve tried a few different ways and can’t seem to get it to work.

Any ideas?

  • You must to post comments
0
0

I just tried and it works for me. Are you storing the value in CellValuePushed and retrieving it in CelValueNeeded?

  • You must to post comments
0
0

CellValuePushed is an event from the DataGridView how would I invoke it?

  • You must to post comments
0
0

Here is a slimmed down sample of what I am trying to do.

Thanks,
Mark

  • You must to post comments
0
0

Okay I think I figured out a way to do it. Not sure if it is the most efficient but setting the rowcount = 0 and then setting it back seems to work and I don’t look the selecteditems.

 

dgComputers.RowCount = 0;
dgComputers.RowCount = ComputerSelectSqlGenerator.TotalItems.Result;

  • You must to post comments
0
0

Hi Mark,

Sorry for the delay, I just got around to this. I have attached the modified sample.

  • Don’t need to use Application.Update() when using a timer, the timer runs on the client and causes callbacks, therefore the thread responding will automatically update the client when it’s done. You’d need Application.Update() if you were using a server side timer or an independent thread or task, which is “out of bound”, meaning not related to a client request and Wisej needs to restore the session on the thread to push the update.
  • When the DGV is in VirtualMode, you have to provide data storage. Assigning the value of a cell doesn’t save the value, raises CellValuePushed and then it’s up to your virtual implementation to store the value. In the modified sample I used a dictionary.

HTH

Best,

Luca

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.