您的位置:首页 > 编程语言 > C#

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

2017-07-26 18:04 316 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: