次の方法で共有


BaseForm.ShowError(Exception, String, Boolean) メソッド

定義

指定した例外および例外に関する情報をメッセージ ボックスに表示します。

protected public:
 void ShowError(Exception ^ exception, System::String ^ message, bool isWarning);
protected internal void ShowError (Exception exception, string message, bool isWarning);
member this.ShowError : Exception * string * bool -> unit

パラメーター

exception
Exception

表示する例外。

message
String

エラー メッセージ。

isWarning
Boolean

true 警告記号を表示する場合は 。 false をクリックすると、エラー 記号が表示されます。

次の例では、 メソッドを ShowError 使用して例外情報を表示します。

protected override void DisplayErrorMessage(Exception ex,
    ResourceManager resourceManager) {
    string errorText = null;
    string errorMessage = null;

    ModuleServiceProxy.GetErrorInformation(ex,
        resourceManager, out errorText, out errorMessage);

    string errorString = String.Empty;

    if (String.IsNullOrEmpty(errorText)) {
        errorText = "Unknown Error Message";
        errorString = errorText + "Error Details \n"
            + errorMessage;
    } else {
        errorString = errorText;
    }

    ShowError(null, errorString, false);
}

注釈

このメソッドは、 メソッドを GetService 呼び出して、エラー メッセージを表示するサービス オブジェクトを取得します。

適用対象