Thread-safe updates of a WinForm control from other classes

前端 未结 4 1035
不思量自难忘°
不思量自难忘° 2021-01-13 15:20

Could someone please help me with the following problem:

There are two classes MainForm and LWriter. Below is a method from the LWriter that in addition to writing

4条回答
  •  佛祖请我去吃肉
    2021-01-13 16:04

    Interactions with UI controls must be done on the UI thread. You can build the string on a background thread, but you should use Control.Invoke or Control.BeginInvoke to marshal to the UI thread before interacting with it.

    Lots of examples of this on the net and stack overflow.

提交回复
热议问题