C# application is blocked

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Under a Windows CE .NET 4.2 OS, I have a problem with a C# application which
is the following :
when I call often a routine, my application is blocked on the MessageBox and
I must do a reboot of the PDA.

The routine is the following :

---------------------------------------------------------------------
private void routine()
{
MessageBox.Show("Message", "Title");
textBox1.Text = "";
textBox1.Enabled = false;
textBox2.Enabled = true;
textBox2.Text = "";
textBox2.Focus();
}
-------------------------------------------------------
When I debug, I have no message, I can see where the program is blocking.
I think it's a problem between the MessageBox and the focus on "textBox2"
field ?

Thanks for any help.
 
Is "routine" running in a separate thread or in an event handler (like for a
timer)?

-Chris
 
OK, thanks.
But what do you mean exactly, should I use this method after
"MessageBox.Show()" ? So "textBox2.Invoke()" in the sample of code I gave you
in the last post ?

Thanks in advance for any information.
 
If you read the link I sent and the links it points to you will get the
answer to the question you ask, gain a better understanding on why the
advice was given and also never face this problem again.

Whether you decide to Invoke from wherever you call that routine so the
whole method is on the UI thread or whether you decide to split the method
so the msgbox happens before Invoking is your decision which you will be
able to make once you follow the links.

Cheers
Daniel
 
The point is, what is calling "routine"? In what thread context is it
running? If it's not the UI thread, then calls to UI elements must go
through Invoke.

-Chris
 
Back
Top