Chapter 19 - Pooling Sample Code
Has anyone managed to get the Pooling sample to work? I have created my own application and downloaded the sample code for the book and both fail to run with the same problem.
I've coded around the problem by sending the data to the output window.
To prove that I could get data back to the form I modified the WorkerEnd method to pass back some additional data that is stored in private member variables. I then have a timer that loops around and updates the UI every few seconds.
I believe the issue is with the age of the book. In .NET 1.1 and before you could directly access the UI elements on the main thread from a worker thread. However, in .NET 2.0 (I believe) this changed so that you could no longer directly access UI elements from a worker thread. The samples written to do so will not work on current versions of .NET. Take a look at threading from a new version of the book (the code sample) and I expect you'll find that it no longer directly accesses the UI elements from a worker thread.
|All times are GMT -4. The time now is 02:25 AM.|
Powered by vBulletin®
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.