Re: Progress bar update from worker thread
am 04.12.2007 22:45:46 von mattias.dont.want.spam
>I have the standard progress bar and worker thread scenario with
>progress of the worker thread being fed back to the main UI and
>displayed on the progress bar. I have a delegate and am using
>BeginInvoke. But the progress bar is not updating.
You should use Control.BeginInvoke on a control or form, not
Delegate.BeginInvoke.
Mattias
--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Re: Progress bar update from worker thread
am 05.12.2007 14:37:06 von p-.-a-.-w-a-r-d-
Mattias Sjögren wrote:
>> I have the standard progress bar and worker thread scenario with
>> progress of the worker thread being fed back to the main UI and
>> displayed on the progress bar. I have a delegate and am using
>> BeginInvoke. But the progress bar is not updating.
Have you come across the BackgroundWorker class yet? (new to Framework
2.0, IIRC). It is specifically designed for this situation, marshaling
events from the worker thread back onto the UI thread and getting round
all these marshaling problems.
HTH,
Phill W.
Re: Progress bar update from worker thread
am 06.12.2007 04:30:02 von surturz
I've not really mucked around with threads much, but why not just use
..DoEvents within the processing loop?
-SurturZ
"Phill W." wrote:
> Mattias Sjögren wrote:
> >> I have the standard progress bar and worker thread scenario with
> >> progress of the worker thread being fed back to the main UI and
> >> displayed on the progress bar. I have a delegate and am using
> >> BeginInvoke. But the progress bar is not updating.
>
> Have you come across the BackgroundWorker class yet? (new to Framework
> 2.0, IIRC). It is specifically designed for this situation, marshaling
> events from the worker thread back onto the UI thread and getting round
> all these marshaling problems.
>
> HTH,
> Phill W.
>