MessageBox doesn't show on mdi form after a long calculation
Posted
by Rekreativc
on Stack Overflow
See other posts from Stack Overflow
or by Rekreativc
Published on 2010-03-30T10:41:32Z
Indexed on
2010/03/30
10:43 UTC
Read the original article
Hit count: 486
Hello
This is a very similar problem to This one, sadly that one was never answered either.
I have a MDI Main forum that hosts several children forms. One of them does a long calculation and throws an exception if an error occurs (all work is done on the same thread). I then try to inform the user of an error with an messagebox, however it doesn't appear (but steals focus from the MDI Main, so the application is completely unresponsive).
The beheviour changes slightly if I call Application.DoEvents() (evil I know, but this is a last resort thing). Then the forms remain completely active and the messagebox only appears after I change active application (Alt+Tab) to something else and then back again.
What can I do to make sure the messagebox will be visible? I have already tried passing both, active child and MDI Main as parameter to the MessageBox.Show method. It doesn't change the behaviour.
© Stack Overflow or respective owner