ExceptionMessageBox.Show Metode
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Menampilkan kotak pesan pengecualian.
Overload
| Show(IWin32Window) |
Memperlihatkan kotak pesan pengecualian sebagai kotak dialog modal yang berpusat di jendela induk. |
| Show(IntPtr, String, String, String, String, String, String, String) |
Menampilkan kotak pesan pengecualian. Diidentifikasi hanya untuk tujuan informasi. Tidak didukung. Kompatibilitas di masa mendatang tidak dijamin. |
Show(IWin32Window)
Memperlihatkan kotak pesan pengecualian sebagai kotak dialog modal yang berpusat di jendela induk.
public:
System::Windows::Forms::DialogResult Show(System::Windows::Forms::IWin32Window ^ owner);
public System.Windows.Forms.DialogResult Show (System.Windows.Forms.IWin32Window owner);
member this.Show : System.Windows.Forms.IWin32Window -> System.Windows.Forms.DialogResult
Public Function Show (owner As IWin32Window) As DialogResult
Parameter
- owner
- IWin32Window
Jendela induk untuk kotak pesan pengecualian.
Mengembalikan
Tombol DialogResult yang diklik oleh pengguna.
Contoh
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);
}
Try
' Do something that may generate an exception.
Throw New ApplicationException("An error has occured")
Catch ex As ApplicationException
' Define a new top-level error message.
Dim str As String = "The action failed."
' Add the new top-level message to the handled exception.
Dim exTop As ApplicationException = New ApplicationException(str, ex)
exTop.Source = Me.Text
' Show an exception message box with an OK button (the default).
Dim box As ExceptionMessageBox = New ExceptionMessageBox(exTop)
box.Show(Me)
End Try
Keterangan
Ketika Buttons adalah Custom, Show selalu mengembalikan Cancel. Gunakan CustomDialogResult untuk menentukan tombol mana yang diklik pengguna.
null Ketika nilai disediakan untuk Owner, kotak pesan pengecualian muncul di Taskbar Windows. Kami menyarankan agar Anda meneruskan objek jendela induk sebagai gantinya.
Berlaku untuk
Show(IntPtr, String, String, String, String, String, String, String)
Menampilkan kotak pesan pengecualian. Diidentifikasi hanya untuk tujuan informasi. Tidak didukung. Kompatibilitas di masa mendatang tidak dijamin.
public:
System::Windows::Forms::DialogResult Show(IntPtr hwnd, System::String ^ message, System::String ^ source, System::String ^ sourceAppName, System::String ^ sourceAppVersion, System::String ^ sourceModule, System::String ^ sourceMessageId, System::String ^ sourceLanguage);
public System.Windows.Forms.DialogResult Show (IntPtr hwnd, string message, string source, string sourceAppName, string sourceAppVersion, string sourceModule, string sourceMessageId, string sourceLanguage);
member this.Show : nativeint * string * string * string * string * string * string * string -> System.Windows.Forms.DialogResult
Public Function Show (hwnd As IntPtr, message As String, source As String, sourceAppName As String, sourceAppVersion As String, sourceModule As String, sourceMessageId As String, sourceLanguage As String) As DialogResult
Parameter
- hwnd
-
IntPtr
nativeint
System.IntPtr yang merupakan handel ke jendela induk.
- message
- String
String yang berisi pesan untuk pengecualian yang terkait dengan instans ini.
- source
- String
String yang berisi sumber untuk pengecualian yang terkait dengan instans ini.
- sourceAppName
- String
String yang berisi nama aplikasi sumber.
- sourceAppVersion
- String
String yang berisi versi aplikasi sumber.
- sourceModule
- String
String yang berisi nama modul sumber.
- sourceMessageId
- String
String yang berisi ID pesan sumber.
- sourceLanguage
- String
String yang berisi bahasa sumber.
Mengembalikan
Tombol DialogResult yang diklik oleh pengguna.