ExceptionMessageBoxButtons Enum

Definisi

Menentukan tombol untuk ditampilkan dalam kotak pesan pengecualian.

public enum class ExceptionMessageBoxButtons
public enum ExceptionMessageBoxButtons
type ExceptionMessageBoxButtons = 
Public Enum ExceptionMessageBoxButtons
Warisan
ExceptionMessageBoxButtons

Bidang

Nama Nilai Deskripsi
AbortRetryIgnore 4

Tampilkan tombol Batalkan, Coba Lagi, dan Abaikan .

Custom 6

Tampilkan tombol dengan teks tombol kustom.

OK 0

Tampilkan tombol OK .

OKCancel 1

Tampilkan tombol OK dan Batal .

RetryCancel 5

Tampilkan tombol Coba Lagi dan Batalkan .

YesNo 3

Tampilkan tombol Ya dan Tidak .

YesNoCancel 2

Tampilkan tombol Ya, Tidak, dan Batal .

Contoh

// 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

Keterangan

Saat Anda menggunakan Custom, Anda harus memanggil SetButtonText untuk mengatur teks tombol sebelum menampilkan kotak pesan. Setelah pengguna menutup kotak pesan pengecualian, panggil CustomDialogResult untuk menentukan tombol mana yang diklik pengguna.

Berlaku untuk