Message processing and other events in .NET all depends on what thread such
work is being done in. From the sounds of it, your database work is being
done in the same thread as your main form... one alternative to this would be
of course to spawn off a thread to do the work for you... another that I
would suggest looking into using an asynchronous event.
Take a look at
http://msdn.microsoft.com/library/de...ngoverview.asp for a great overview on this.
In short though, the way Asyncs work is you fire off an AsyncEvent in one
thread, and go back to whatever it was you were doing and wait for the event
to complete. Along the way, you can periodically poll for status, or if you
don’t care, fire it and forget it (forget it as far as the main thread/code
is concerned, however you still have to do a little house cleaning (ie
EndInvoke())).
By firing the AsyncEvents from your main form, you leave it free to
immediately display any updates received, while leaving your code up to be
executed by the system.
Brendan
"RajS" wrote:
Hi All,
I have created this UI program, i call couple of database procedures and
update process steps to list box.
Program runs fine, but I have problem. What happens is I dont see the update
as it happens, I see all of them after completing all the procedure run.
for example:
UpdateList("Step one about to start");
try{
run proc();
UpdateList("Step one completed");
}catch(Exception ex){
UpdateList("error running proc");
}
UpdateList("Step two about to start");
try{
run proc2();
UpdateList("Step two completed");
}catch(Exception ex){
UpdateList("error running proc2");
}
in updateList I show the status log.
In other language (powerbuilder), i call yield() function to update the ui
and free the message queue.
Any help is appreciated.
Thanks,
--
-RajS