[dba-VB] Background worker threads

jwcolby jwcolby at colbyconsulting.com
Wed Apr 30 08:09:45 CDT 2008


I am new to this worker thread thing.  I know that the worker can report 
status but it does so by raising an event and passing a single value (or 
object) to the event handler.

I currently have a user form that in the past I simply raised an event 
from my class and the form sank the event and updated a text box.  Which 
event I raised determined which text box got updated.

Now my thread can't raise that same event(s) AFAICT because the event 
sink writes to the text box on the form.  However the progress changed 
event that it can raise is limited to a single parameter, but I need to 
update several different status boxes on the main form.

My thought is to create a status class which has a couple of fields, the 
name of the control to update and the data to put in the control.  The 
worker thread would then instantiate one of these status classes, fill 
it in, and raise its ProgressChanged event passing out the status class 
instance.  The progressChanged sink receives that status class instance 
and processes it.  It can use the control name to raise the correct 
event, passing the value to be stuffed into the control.

Does that make sense or is there a simpler way?


-- 
John W. Colby
www.ColbyConsulting.com




More information about the dba-VB mailing list