ExceptionMessageBox.ShowCheckBox Property

 

Specifies whether to show the check box in the exception message box.

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

public bool ShowCheckBox { get; set; }

Property Value

Type: System.Boolean

A Boolean value.

The value of the check box can be evaluated at runtime when an exception occurs to determine whether to display the exception message box. For more information, see Program Exception Message Box.

The default value is false.

try
{
	// Do something that may cause an exception.
	throw new ApplicationException("An error has occured.");
}
catch (ApplicationException ex)
{
	string str = "The action failed.";
	ApplicationException exTop = new ApplicationException(str, ex);
	exTop.Source = this.Text;

	// Show a message box if the global variable is true.
	if (alwaysShow)
	{
		ExceptionMessageBox box = new ExceptionMessageBox(exTop);
		box.ShowCheckBox = true;
		box.IsCheckBoxChecked = true;
		box.CheckBoxText = "Always show this message";
		box.Show(this);

		// Set the global variable.
		alwaysShow = box.IsCheckBoxChecked;
	}
}
Return to top
Show: