# Thursday, April 03, 2008

Proper Threading

I'm primarily a web-based interface programmer, I haven't done non-web-based applications for my main gig for a while, though in the before web age I did dial-up applications (in ansi!). They, however, didn't need multi-threading for updating the GUI while doing the work in a separate thread. This is one thing that has always daunted me with Windows applications, perhaps VB and c++ programmers just like dealing with all the threading issues for fun. Finally I found this:

The BackgroundWorker Component allows a form to run an operation asynchronously. This is very useful when we deal with such kind of operations as database transactions, image downloads etc. In this case our user interface can hang (or not appear until loading will be finished). In this article I will show (step-by-step) how you can use the BackgroundWorker Component in .NET 2 applications to execute time-consuming operations. The examples are written using C#.

[ Using the BackgroundWorker Component in .NET 2 applications ]

Perhaps I was supposed to know that was there all along, of course since much of what I do in .net happens so quickly that multi-threading is useless, and the interface is all sent via HTML, etc., I've just never run across having to do this right, until today. Doing a DB import of 25K+ records from access into a local SQL server requires more time than the GUI updating would like, and this was the easy-peasey-lemon-squeezey way of doing that, let me tell you. Just drag this tool onto the playing field, and then double-click a few auto-stubbed event handlers, plus toggle the property "WorkerSupportsProgress", wire up what I want to get done with a call to notify the progress bar, wire in the progress bar updater, and voilĂ ! it's almost like I know what I'm doing...

#    Comments [1] |
Thursday, April 03, 2008 10:21:03 PM (Eastern Standard Time, UTC-05:00)
Heh, even ColdFusion supports multithreading now (CFTHREAD). I have yet to use it either, although some stuff I've read as examples sounds interesting.
Comments are closed.