Bill,
What Stoitcho & I are suggesting is:
MessageBox.Show (this, "Data Error:\n" + err.Message);
As long as SummaryView_Loa d is in a form.
Also, rather scattering try/catch/MessageBox all over my app I would use a
global exception handler with a single try/catch/MessageBox that is able to
log the exception & show it to the user.
Depending on the type of application you are creating, .NET has three
different global exception handlers.
For ASP.NET look at:
System.Web.Http Application.Err or event
Normally placed in your Global.asax file.
For console applications look at:
System.AppDomai n.UnhandledExce ption event
Use AddHandler in your Sub Main.
For Windows Forms look at:
System.Windows. Forms.Applicati on.ThreadExcept ion event
Use AddHandler in your Sub Main.
It can be beneficial to combine the above global handlers in your app, as
well as wrap your Sub Main in a try catch itself.
There is an article in the June 2004 MSDN Magazine that shows how to
implement the global exception handling in .NET that explains why & when you
use multiple of the above handlers...
http://msdn.microsoft.com/msdnmag/is...T/default.aspx
For example: In my Windows Forms apps I would have a handler attached to the
Application.Thr eadException event, plus a Try/Catch in my Main. The
Try/Catch in Main only catches exceptions if the constructor of the MainForm
raises an exception, the Application.Thr eadException handler will catch all
uncaught exceptions from any form/control event handlers.
Hope this helps
Jay
"Bill" <nf*@nospam.com > wrote in message
news:On******** *****@TK2MSFTNG P11.phx.gbl...
"Stoitcho Goutsev (100) [C# MVP]" <10*@100.com> wrote in message
news:u9******** ******@TK2MSFTN GP12.phx.gbl... Hi Bill,
I can't reproduce your problem. However try to pass reference to the
form as messagebox' owner.
If it doesn't help I would suggest you to post some code that
demonstrates the problem.
--
Stoitcho Goutsev (100) [C# MVP]
I am displaying the error message as follows:
private void SummaryView_Loa d(object sender, System.EventArg s e)
{
try
{
twsDS1 = SummaryBO.Insta nce.twsDS;
}
catch (Exception err)
{
MessageBox.Show ("Data Error:\n" + err.Message);
return;
}
}