What is the difference between InvokeRequired
and somecontrol.InvokeRequired
?
like this,
delegate void valueDelegate(string value);
private void SetValue(string value)
{
if (InvokeRequired)
{
BeginInvoke(new valueDelegate(SetValue),value);
}
else
{
someControl.Text = value;
}
}
and
delegate void valueDelegate(string value);
private void SetValue(string value)
{
if (someControl.InvokeRequired)
{
someControl.Invoke(new valueDelegate(SetValue),value);
}
else
{
someControl.Text = value;
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…