ShowDialog returns immediately after a handled exception in .net compact framework

Posted by leiz on Stack Overflow See other posts from Stack Overflow or by leiz
Published on 2010-04-01T09:58:38Z Indexed on 2010/05/16 0:00 UTC
Read the original article Hit count: 252

The problem I am having is that for some reason ShowDialog returns immediately after handle an exception. However, it works for MessageBox.Show() or at the second time I call ShowDialog. What is the best workaround for this problem?

I was only able to find this. And I cannot believe that no one else has this issue.

I am using .net compact framework 3.5. Sample code:

try
{
  using(SomeForm f = new SomeForm())
  {
    f.ShowDialog();
  }
}
catch(SomeException)
{
  using(SomeOtherForm f = new SomeOtherForm())
  {
    f.ShowDialog(); // this returns immediately
                    // if this is MessageBox.Show(), it works correctly.
    f.ShowDialog(); // then this works fine
  }
}

© Stack Overflow or respective owner

Related posts about compact-framework

Related posts about c#