Cross-thread operation not valid in Windows Forms

前端 未结 7 1413
醉酒成梦
醉酒成梦 2020-12-11 17:52

Could anyone help me i have a problem I\'m trying to get this code to work in the background via threadpool but i cannot seem to get it to work i keep getting this error:

相关标签:
7条回答
  • 2020-12-11 18:30

    You can also access controls via invoke using the following syntax with an Action delegate:

     Invoke((Action)(() =>
     {
          var myVar = SomeWinFormControl.Property;
     }));
    
    0 讨论(0)
提交回复
热议问题