Wpf MessageBox.Show does not block

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
 
D

DH

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.
 
A

Andy

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.
 
D

DH

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top