C#: String as parameter to event?

前端 未结 4 1561
独厮守ぢ
独厮守ぢ 2021-01-04 17:22

I have a GUI-thread for my form and another thread that computes things.

The form has a richtTextBox. I want the worker-thread to pass strings to the form, so that e

4条回答
  •  Happy的楠姐
    2021-01-04 18:07

    In general you need to inherit EventArgs and add a string property, and then make your event of type EventHandler, but that is a classic case for the BackgroundWorker.

    Sample here: http://msdn.microsoft.com/en-us/library/cc221403(v=vs.95).aspx

    and here: C# backgroundWorker reports string?

提交回复
热议问题