//设置为后台线程 Thread th = new Thread(delegate() { append(); }); th.IsBackground = true; th.Start(); //在append方法里面需要调用前台控件 public void append(){ // ... 业务处理 this.Invoke(new flushMessage(showMessage), new object[] { row["Code"].ToString(), res }); } //委托flushMessage和方法showMessage签名必须一致 private delegate void flushMessage(String id, String res); private void showMessage(String id,String res) { if (res == "true") { txtMsg.Text += "\t\t\t\t" + id + "\t\t\t\t导入成功\r\n"; } else { txtMsg.Text += "\t\t\t\t" + id + "\t\t\t\t\t导入失败\r\n"; } }