IUIService.ShowError 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
在訊息框中顯示指定的錯誤訊息。
多載
| 名稱 | Description |
|---|---|
| ShowError(Exception) |
在訊息框中顯示指定的例外及相關資訊。 |
| ShowError(String) |
在訊息框中顯示指定的錯誤訊息。 |
| ShowError(Exception, String) |
在訊息框中顯示指定的例外及相關資訊。 |
ShowError(Exception)
在訊息框中顯示指定的例外及相關資訊。
public:
void ShowError(Exception ^ ex);
public void ShowError(Exception ex);
abstract member ShowError : Exception -> unit
Public Sub ShowError (ex As Exception)
參數
備註
使用此方法可使訊息框顯示與開發環境妥善整合。
適用於
ShowError(String)
在訊息框中顯示指定的錯誤訊息。
public:
void ShowError(System::String ^ message);
public void ShowError(string message);
abstract member ShowError : string -> unit
Public Sub ShowError (message As String)
參數
- message
- String
錯誤訊息要顯示。
備註
使用此方法可使訊息框顯示與開發環境妥善整合。
適用於
ShowError(Exception, String)
在訊息框中顯示指定的例外及相關資訊。
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)
參數
- message
- String
一個訊息要顯示,提供關於例外的資訊。
範例
以下程式碼範例嘗試取得 並 IUIService 呼叫服務 ShowError 方法的實例。
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
備註
使用此方法可使訊息框顯示與開發環境妥善整合。