0

我正在更新线程中的行值

dataGrid[col,row].value = msg;

如果我直接使用,上面的语法可以正常工作,但是当我在线程中使用它时,它不会更新数据网格。后来我使用委托来更新行

 if (dataGrid.InvokeRequired)
 {
 //-------------- Delegate Create a differnt thread and end cross reference thread error --
 dGStatusTextDelegate deleg = new dGStatusTextDelegate(dataGridStatusUpdate);
 dataGrid.BeginInvoke(deleg, new object[] { msg,statuscol,row });
 }
 else
 dataGrid[statuscol,row].Value = msg;

仍然是相同的响应,数据网格中没有更新。当我不使用线程时它可以工作。任何帮助

4

1 回答 1

0

I used a simple trick to carry the loop value (i) into a temp variable (j). After this it started to work correctly

于 2013-06-08T19:39:54.087 回答