ExceptionMessageBoxButtons Enum
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Specifies the button to display in the exception message box.
public enum class ExceptionMessageBoxButtons
public enum ExceptionMessageBoxButtons
type ExceptionMessageBoxButtons =
Public Enum ExceptionMessageBoxButtons
- Inheritance
-
ExceptionMessageBoxButtons
Fields
AbortRetryIgnore | 4 | Display the Abort, Retry, and Ignore buttons. |
Custom | 6 | Display buttons with custom button text. |
OK | 0 | Display the OK button. |
OKCancel | 1 | Display the OK and Cancel buttons. |
RetryCancel | 5 | Display the Retry and Cancel buttons. |
YesNo | 3 | Display Yes and No buttons. |
YesNoCancel | 2 | Display Yes, No, and Cancel buttons. |
Examples
// Define the message and caption to display.
string str = @"Are you sure you want to delete file 'c:\somefile.txt'?";
string caption = "Confirm File Deletion";
// Show the exception message box with Yes and No buttons.
ExceptionMessageBox box = new ExceptionMessageBox(str,
caption, ExceptionMessageBoxButtons.YesNo,
ExceptionMessageBoxSymbol.Question,
ExceptionMessageBoxDefaultButton.Button2);
if (DialogResult.Yes == box.Show(this))
{
// Delete the file.
}
' Define the message and caption to display.
Dim str As String = "Are you sure you want to delete file 'c:\somefile.txt'?"
Dim caption As String = "Confirm File Deletion"
' Show the exception message box with Yes and No buttons.
Dim box As ExceptionMessageBox = New ExceptionMessageBox(str, _
caption, ExceptionMessageBoxButtons.YesNo, _
ExceptionMessageBoxSymbol.Question, _
ExceptionMessageBoxDefaultButton.Button2)
If Windows.Forms.DialogResult.Yes = box.Show(Me) Then
' Delete the file.
End If
Remarks
When you use Custom, you must call SetButtonText to set the button text before you show the message box. After the user dismisses the exception message box, call CustomDialogResult to determine which button the user clicked.