I am trying to Update UI using different threads and use the below process to do so.But getting the above error during invoke. Kindly advice is this not allowed.
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;
}
}