c# - Control.Invoke from same thread where the form is running -
in c#, there problem using control.invoke change property of control same thread form running?
i know best using control.property = value
, i'd know consequences of using control.invoke instead.
example:
using this:
public partial class formmain : form { private void button1_click(object sender, eventargs e) { this.invoke(new delegate {label1.text = "hello"}); } }
instead of this:
public partial class formmain : form { private void button1_click(object sender, eventargs e) { label1.text = "hello"; } }
this.invoke(new action( delegate() { label2.text = "test"; }));
or
this.invoke(new methodinvoker( delegate() { label2.text = "test"; }));
Comments
Post a Comment