我试图用不同的线程更新UI,并使用下面的过程中做so.But调用期间获得上述错误。请注意,这是不允许的。system.reflection.targetparametercountexception参数数量不匹配参数数量不匹配
delegate void SetLabelCallback(string text,string Qmgr);
private void Set_status(string text, string Qmgr)
{
if (this.Status1A.InvokeRequired)
{
SetTextCallback d = new SetTextCallback(record_count);
this.Invoke(d, new object[] { text,Qmgr });
}
else
{
switch (Qmgr)
{
case "GCSSPR1A": this.Status1A.Text = text;
break;
case "GCSSPR1B": this.B1_Status.Text = text;
break;
case "GCSSPR2A": this.A2_Status.Text = text;
break;
case "GCSSPR2B": this.B2_Status.Text = text;
break;
case "GCSSPR3A": this.A3_Status.Text = text;
break;
case "GCSSPR3B": this.B3_Status.Text = text;
break;
}
}
什么是'record_count'的定义是什么? –
你使用C#4吗?如果是这样,你可以使这个代码更简单,更不容易出错。 – Baldrick
错字在我的代码固定它... – user2772983