My Assistant
![]()
Custom Search
|
![]() ![]() |
![]() |
![]() Post#1 | |
Utter Spammer Posts: 4 Joined: 21-March 18 ![]() | Passing data prom one thread to another Hi, I have created a process that's runing a thread that open some windows form, now i want that other running threads from the same process will be able to pass data to this windows form or even close it or reopen it. The Windows form GUI is always in use of the end users so i cant lock. what is the best way to implement it in c# ? i would like a short example, thanks. |
![]() Post#2 | |
![]() UtterAccess Editor Posts: 9,951 Joined: 7-December 09 From: Staten Island, NY, USA ![]() | There's no simple example that can be given: threading (and sharing data between threads) is a complex subject. Especially if that data is mutable - you're working in some ugly territory and there's a fair bit of background theory you should be aware of. Multithreading is rife with pitfalls and subtleties. I'm not sure which UI framework you're using (WinForms, WPF, Xamarin, etc?), but generally speaking take a look at Invoke and BeginInvoke or Task.Run. There's many other ways to do it, but I do suggest some background reading on general threading concepts so you're not blindly walking into dangerous territory (there's entire books devoted to the subject...). |
![]()
Custom Search
|
![]() | Search Top Lo-Fi | 17th February 2019 - 02:58 PM |