Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > BOOK: Professional VB.NET, 2nd Edition or 2003
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional VB.NET, 2nd Edition or 2003
This is the forum to discuss the Wrox book Professional VB.NET, 2nd Edition by Fred Barwell, Richard Case, Bill Forgey, Billy Hollis, Tim McCarthy, Jonathan Pinnock, Richard Blair, Jonathan Crossland, Whitney Hankison, Rockford Lhotka, Jan D. Narkiewicz, Rama Ramachandran, Matthew Reynolds, John Roth, Bill Sheldon, Bill Sempf; ISBN: 9780764544002
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional VB.NET, 2nd Edition or 2003 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old November 27th, 2009, 07:39 AM
dmn dmn is offline
Registered User
Join Date: Nov 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question 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.

System.InvalidOperationException was unhandled

"Cross-thread operation not valid: Control 'txtStatus' accessed from a thread other than the thread it was created on."
The VS online help seems to be suggesting that we need to invoke the update to the control.

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.
Reply With Quote
  #2 (permalink)  
Old November 27th, 2009, 09:23 PM
Wrox Author
Join Date: Aug 2003
Location: Oceanside, CA, USA.
Posts: 12
Thanks: 0
Thanked 2 Times in 2 Posts
Default Old Version

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.
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Where is the sample code for Chapter 29 reddyjyoshna BOOK: Professional C# 2005 with .NET 3.0 ISBN: 978-0-470-12472-7 0 December 18th, 2008 07:14 AM
Chapter 10 Sample Code jramkawsky BOOK: Professional Java Development with the Spring Framework 0 December 3rd, 2005 07:44 AM
chapter 25 -sample code LouMattera BOOK: Professional C#, 2nd and 3rd Editions 3 February 13th, 2005 05:39 AM
Chapter 16 missing sample code bruceaj VB.NET 2002/2003 Basics 3 June 18th, 2003 08:18 AM

All times are GMT -4. The time now is 03:41 PM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.