C#线程调用带参数的方法,给控件赋值


System.Threading.Thread thread = new System.Threading.Thread(() =>
{

//各种业务


//定义一个委托
public delegate void ProcessDelegate(string a);
if (this.lbStatus.InvokeRequired)
{
ProcessDelegate df = new ProcessDelegate(AddStatus);
this.Invoke(df, new object []{ "调用Web Service过程产生错误:" + ls_ErrMsg });
}
});
thread.IsBackground = true;
thread.Start;

----以上自己修改,亲测可以使用

参考自 : http://www.jb51.net/article/56428.htm

 

posted @ 2017-07-26 18:04  李文平  阅读(389)  评论(0编辑  收藏  举报