ExceptionMessageBox Constructor (Exception)

 

Creates an instance of ExceptionMessageBox by using information from the specified Exception.

Namespace:   Microsoft.SqlServer.MessageBox
Assembly:  Microsoft.ExceptionMessageBox (in Microsoft.ExceptionMessageBox.dll)

public ExceptionMessageBox(
	Exception exception
)

Parameters

exception
Type: System.Exception

Exception that contains the top-level text, inner exception text, caption, data, help link, and optional additional information to display in the exception message box.

try
{
	// Do something that may generate an exception.
	throw new ApplicationException("An error has occured");
}
catch (ApplicationException ex)
{
	// Define a new top-level error message.
	string str = "The action failed.";

	// Add the new top-level message to the handled exception.
	ApplicationException exTop = new ApplicationException(str, ex);
	exTop.Source = this.Text;

	// Show an exception message box with an OK button (the default).
	ExceptionMessageBox box = new ExceptionMessageBox(exTop);
	box.Show(this);
}
Return to top
Show: