Click here to Skip to main content
15,949,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a datagridView that implements virtualMode, things "seems" to working correctly. My dataStore is changing a few times per/sec and my dataGridView only reflect the updates if I scroll or click on a cell. How do I get the grid to update as my dataStore changes with having to scroll or click?

BindingList<MyObj> ojbList = new BindingList<MyObj>();

void updateMyObjEventHandler(string name, int age)
{
    objList.Add(new MyObj(name,age));
}
 
dataGridView1.VirtulMode = true;
dataGridView1.+= new DataGridViewCellValueEventHandler(dataGridView1_CellValueNeeded);
// add columns etc...


private void dataGridView1_CellValueNeeded(object sender, DataGridCellValueEventArgs e)
{
   MyObj myObjTemp = (MyObj)objList[e.RowIndex];

   e.Value = myObjTemp.Name;
   e.Value = myObjTemp.Age;
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900