Upravit

Sdílet prostřednictvím


IUIService.ShowError Method

Definition

Displays the specified error message in a message box.

Overloads

ShowError(Exception)

Displays the specified exception and information about the exception in a message box.

ShowError(String)

Displays the specified error message in a message box.

ShowError(Exception, String)

Displays the specified exception and information about the exception in a message box.

ShowError(Exception)

Displays the specified exception and information about the exception in a message box.

public:
 void ShowError(Exception ^ ex);
public void ShowError (Exception ex);
abstract member ShowError : Exception -> unit
Public Sub ShowError (ex As Exception)

Parameters

ex
Exception

The Exception to display.

Remarks

Using this method enables the message box display to be properly integrated with the development environment.

Applies to

ShowError(String)

Displays the specified error message in a message box.

public:
 void ShowError(System::String ^ message);
public void ShowError (string message);
abstract member ShowError : string -> unit
Public Sub ShowError (message As String)

Parameters

message
String

The error message to display.

Remarks

Using this method enables the message box display to be properly integrated with the development environment.

Applies to

ShowError(Exception, String)

Displays the specified exception and information about the exception in a message box.

public:
 void ShowError(Exception ^ ex, System::String ^ message);
public void ShowError (Exception ex, string message);
abstract member ShowError : Exception * string -> unit
Public Sub ShowError (ex As Exception, message As String)

Parameters

ex
Exception

The Exception to display.

message
String

A message to display that provides information about the exception.

Examples

The following code example attempts to obtain an instance of the IUIService and invoke the service's ShowError method.

IUIService^ UIservice = dynamic_cast<IUIService^>(this->GetService( System::Windows::Forms::Design::IUIService::typeid ));
if ( UIservice != nullptr )
      UIservice->ShowError( gcnew Exception( "This is a message in a test exception, displayed by the IUIService",gcnew ArgumentException( "Test inner exception" ) ) );
IUIService UIservice = (IUIService)this.GetService( 
    typeof( System.Windows.Forms.Design.IUIService ) );
if( UIservice != null )            
    UIservice.ShowError( new Exception(
        "This is a message in a test exception, " + 
        "displayed by the IUIService", 
         new ArgumentException("Test inner exception")));
Dim UIservice As IUIService = CType(Me.GetService( _
    GetType(System.Windows.Forms.Design.IUIService)), IUIService)
If (UIservice IsNot Nothing) Then
    UIservice.ShowError(New Exception( _
        "This is a message in a test exception, displayed by the IUIService", _
        New ArgumentException("Test inner exception")))
End If

Remarks

Using this method enables the message box display to be properly integrated with the development environment.

Applies to