別のスレッドを使用して UI を更新しようとしており、以下のプロセスを使用してそうしていますが、呼び出し中に上記のエラーが発生します。これは許可されていません。
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;
}
}