Поделиться через


Метод ExceptionMessageBox.Show (IWin32Window)

Shows the exception message box as a modal dialog box centered on the parent window.

Пространство имен:  Microsoft.SqlServer.MessageBox
Сборка:  Microsoft.ExceptionMessageBox (в Microsoft.ExceptionMessageBox.dll)

Синтаксис

'Декларация
Public Function Show ( _
    owner As IWin32Window _
) As DialogResult
'Применение
Dim instance As ExceptionMessageBox 
Dim owner As IWin32Window 
Dim returnValue As DialogResult 

returnValue = instance.Show(owner)
public DialogResult Show(
    IWin32Window owner
)
public:
DialogResult Show(
    IWin32Window^ owner
)
member Show : 
        owner:IWin32Window -> DialogResult
public function Show(
    owner : IWin32Window
) : DialogResult

Параметры

Возвращаемое значение

Тип: System.Windows.Forms.DialogResult
The DialogResult of the button clicked by the user.

Замечания

When Buttons is Custom, Show always returns Cancel. Use CustomDialogResult to determine which button the user clicked.

When a nullпустая ссылка (Nothing в Visual Basic) value is supplied for Owner, the exception message box appears on the Windows Taskbar. We recommend that you pass the parent window object instead.

Примеры

          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

См. также

Справочник

ExceptionMessageBox Класс

Перегрузка Show

Пространство имен Microsoft.SqlServer.MessageBox