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

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -