C# 错误:Cross-thread operation not valid: Control 'lblStatus'
错误:Cross-thread operation not valid: Control 'lblStatus' accessed from a thread other than the thread it was created on.解决方案:
public void SetStatus(string msg)
{
if (lblStatus.InvokeRequired)
lblStatus.Invoke(new MethodInvoker(delegate
{
lblStatus.Text = msg;
}));
else
lblStatus.Text = msg;
}
页:
[1]