线程控件异步赋值

//gcInterface为控件名称
if (gcInterface.InvokeRequired)
                    {
                        gcInterface.BeginInvoke((MethodInvoker)delegate
                        {
                            dtConfig.Rows[index]["count"] = count;
                            dtConfig.Rows[index]["time"] = costTime;
                            dtConfig.Rows[index]["flag"] = flag;
                            dtConfig.Rows[index]["last_finish_time"] = finishTime;
                            dtConfig.Rows[index]["exp_msg"] = expMsg;
                        });
                    }
                    else
                    {
                        dtConfig.Rows[index]["count"] = count;
                        dtConfig.Rows[index]["time"] = costTime;
                        dtConfig.Rows[index]["flag"] = flag;
                        dtConfig.Rows[index]["last_finish_time"] = finishTime;
                        dtConfig.Rows[index]["exp_msg"] = expMsg;
                    }
原文地址:https://www.cnblogs.com/yuanshuo/p/14940842.html