You should always use Control.Invoke to update UI elements from a worker
thread. There are some limitations in the Compact Framework's Control.Invoke
method but these are not impossible to workaround - See an example here on
Daniel's blog:-
http://www.danielmoth.com/Blog/2004/...d-full-fx.html
Peter
--
Peter Foot
Windows Embedded MVP
www.inthehand.com |
www.opennetcf.org
"Nille" <(E-Mail Removed)> wrote in message
news:52C98140-A034-4AEF-A724-(E-Mail Removed)...
> Hi!
> I have a serious problem with what appears to be a deadlock in .NET cf. It
> occures when I invoke Invalidate on a control from a thread other than the
> main thread when the main thread is busy (i.e. displaying a form).
>
> I have a situation similiar to this:
>
> public class MyForm : System.Windows.Forms.Form
> {
>
> // ...
>
> private void MyThreadedMethod()
> {
> while(true)
> {
> myLabel.Text = "..."; // This hangs the application if the main
> thread is busy.
> System.Threading.Thread.Sleep(1000);
> }
> }
>
> // ...
>
> }
>
> How can I avoid this?
>
> Thanks in advance!
> Nille