[英]Row updation issue in datagrid
I am updating a row value in thread 我正在更新线程中的行值
dataGrid[col,row].value = msg;
the above syntax works fine if i use directly but when i use it in a thread it doesnt update the data grid. 如果我直接使用上述语法,效果很好,但是当我在线程中使用它时,它不会更新数据网格。 Later i used a delegate to update the row 后来我用一个委托来更新行
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;
Still the same responce , no updation in data grid. 仍然是相同的响应,数据网格中没有更新。 It works when i dont use thread. 当我不使用线程时,它起作用。 Any Help 任何帮助
I used a simple trick to carry the loop value (i) into a temp variable (j). 我使用一个简单的技巧将循环值(i)携带到临时变量(j)中。 After this it started to work correctly 此后,它开始正常工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.