开发者

C# threads communication problem

I have to resolve problem which in simple way could be like:

  1. GUI app with Buttons start/stop (start/stop starts/stops the threads) and multiline textbox
  2. 2 independent threads which do: THREAD A (Separated calss): runs in loop and generates random numbers in interval 1..20 with 150ms delay. When is generated odd number, then is sent to mainform where is received multiplied by 100 and result added to the textbox on form. Please, any help, simple code or whatever - or link where to study how to write it开发者_StackOverflow中文版, I'm totally newbie in C#


You should use the Control's BeginInvoke method to marshal data from a background thread to the main thread and update the textBox's properties. You will find an example similar to your task at:

Writing to a TextBox from another thread?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜