ExceptionMessageBoxDialogResult Enumeration

 

Applies To: SQL Server 2016 Preview

Identifies the button that the user clicked to close the exception message box when custom text buttons are used.

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

public enum ExceptionMessageBoxDialogResult

Member nameDescription
Button1

Button2

Button3

Button4

Button5

None

Legacy Code Example

			try
			{
				// Do something that may cause an exception.
				throw new ApplicationException("An error has occured");
			}
			catch (ApplicationException ex)
			{
				string str = "Action failed. What do you want to do?";
				ApplicationException exTop = new ApplicationException(str, ex);
				exTop.Source = this.Text;

				// Show the exception message box with three custom buttons.
				ExceptionMessageBox box = new ExceptionMessageBox(exTop);

				// Set the names of the three custom buttons.
				box.SetButtonText("Skip", "Retry", "Stop Processing");

				// Set the Retry button as the default.
				box.DefaultButton = ExceptionMessageBoxDefaultButton.Button2;
				box.Symbol = ExceptionMessageBoxSymbol.Question;
				box.Buttons = ExceptionMessageBoxButtons.Custom;

				box.Show(this);

				// Do something, depending on the button that the user clicks.
				switch (box.CustomDialogResult)
				{
					case ExceptionMessageBoxDialogResult.Button1:
						// Skip action
						break;
					case ExceptionMessageBoxDialogResult.Button2:
						// Retry action
						break;
					case ExceptionMessageBoxDialogResult.Button3:
						// Stop processing action
						break;
				}
			}
Return to top

Community Additions

ADD
Show: