开发者

Problem in Process Run

When I want to create a new process that target m开发者_JAVA技巧y files, It seem that I have problem with new threads ?

Where is my problem ?

When I started My Application with Proces.Run :

Error message is : Controls created on one thread cannot be parented to a control on a different thread .

but when I want to start normally , I got no problem .


public void UpdateLabelText(String value)
{
  if (_Form.InvokeRequired)
  {
    try { _Form.BeginInvoke(new StringParameterDelegate(UpdateLabelText), new object[] { value }); }
    catch { ;}
    return;
  }

  foreach (Control ctrl in _Form.Controls.Find("labelName", true))
  {
    ((Label)ctrl).Text = value;
    break; // Controls have unique names
  }
}

delegate void StringParameterDelegate(string value);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜