Wpf MessageBox.Show does not block

  • Thread starter Thread starter Andy
  • Start date Start date
A

Andy

Hi,

I have a Wpf application, and have some code in my App.xaml.cs file
that runs on Application_StartUp. It's possible for errors to occur
here, and I let AppDomain.CurrentDomain.UnhandledException or
System.Windows.Application.Current.DispatcherUnhandledException event
handlers handle any errors.

In the error handling routine, I can call MessageBox.Show to display
an error message to the user. This kinda works, as the messagebox
appears, but the program immediately exits and the message box
closes.

Any ideas how to get the application to wait until the messagebox is
dismissed by the user before shutting down?

Thanks
Andy
 
Andy said:
Hi,

I have a Wpf application, and have some code in my App.xaml.cs file
that runs on Application_StartUp. It's possible for errors to occur
here, and I let AppDomain.CurrentDomain.UnhandledException or
System.Windows.Application.Current.DispatcherUnhandledException event
handlers handle any errors.

In the error handling routine, I can call MessageBox.Show to display
an error message to the user. This kinda works, as the messagebox
appears, but the program immediately exits and the message box
closes.

Any ideas how to get the application to wait until the messagebox is
dismissed by the user before shutting down?

Thanks
Andy
How are you calling the Message box. Please provide a short but complete
sample code.
 
I tried creating a simple example, but the messagebox behaves
correctly in it.. so I'm at a loss to explain what is going on here.
 
Andy said:
I tried creating a simple example, but the messagebox behaves
correctly in it.. so I'm at a loss to explain what is going on here.
Provide how you are Calling the event, How you are handelling the event
as well as calling the messagebox and maybe someone in here can tell you
what is happening.
We cannot begin to guess at what your code looks like and why it is
behaving in this fashion.
 
Back
Top