G
Guest
I have a form that I am upload rows into an SQL server database. The form has
a button that when it is clicked creates a Custom Business Object and then
calls the actually upload method from that Business object. I set this up so
that it would run on a seperate thread since it is something like 2000
records that we are dealing with. The form has a progress bar that I would
like to update with each row we import. The only problem is that since I have
called the update from another thread and try and raise an event from the
Custom business object and then handle that event in the form to performStep
on the progress bar. The only thing is doing it this way I get a crossthread
exception when the background thread raises the event and the form tries to
update the progress bar. The only way I can figure out to do this is to
create a delegate within the Custom business object that references the
Progressbar.
Am I doing this wrong, or is there a better way of doing this? It seems to
me that this violates good OO principles and I might as well code everything
in the form instead of creating a Business object.
a button that when it is clicked creates a Custom Business Object and then
calls the actually upload method from that Business object. I set this up so
that it would run on a seperate thread since it is something like 2000
records that we are dealing with. The form has a progress bar that I would
like to update with each row we import. The only problem is that since I have
called the update from another thread and try and raise an event from the
Custom business object and then handle that event in the form to performStep
on the progress bar. The only thing is doing it this way I get a crossthread
exception when the background thread raises the event and the form tries to
update the progress bar. The only way I can figure out to do this is to
create a delegate within the Custom business object that references the
Progressbar.
Am I doing this wrong, or is there a better way of doing this? It seems to
me that this violates good OO principles and I might as well code everything
in the form instead of creating a Business object.