This question has already been answered:
- Work with controls from background thread 2 responses
There is a class with a cycle in a separate thread. There is an EventHandler and a subscription to it in another class. How from a loop in another thread is it safe to create an event? When you try to create it and, for example, create an entry in the textbox, an exception automatically flies with a message attempting access from another thread.
Excerpts from the code:
public event EventHandler<NewDataEventArgs> NewData;- event announcementNewData(this, e);- call event in the stream