Share via


ModulePage.DisplayErrorMessage Method

Definition

Displays a modal dialog box with an error message.

Overloads

DisplayErrorMessage(Exception, ResourceManager)

Displays a modal dialog box with an error message, based on the specified exception and resource manager.

DisplayErrorMessage(String, String)

Displays a modal dialog box with an error message, based on the specified error text and error message.

DisplayErrorMessage(Exception, ResourceManager, String)

Displays a modal dialog box with an error message, based on the specified exception, resource manager, and caption.

DisplayErrorMessage(String, String, String)

Displays a modal dialog box with an error message, based on the specified error text, error message, and caption.

DisplayErrorMessage(Exception, ResourceManager)

Displays a modal dialog box with an error message, based on the specified exception and resource manager.

protected:
 void DisplayErrorMessage(Exception ^ ex, System::Resources::ResourceManager ^ resourceManager);
protected void DisplayErrorMessage (Exception ex, System.Resources.ResourceManager resourceManager);
member this.DisplayErrorMessage : Exception * System.Resources.ResourceManager -> unit

Parameters

ex
Exception

The Exception thrown.

resourceManager
ResourceManager

The ResourceManager object that is associated with the page.

Examples

The following example displays an error message.

DisplayErrorMessage(string.Empty, 
  "My Demo Error Message");

Remarks

Caution

If InetMgr.exe is launched from the debugger, the DisplayErrorMessage method throws a System.InvalidOperationException with the message "Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on."

The dialog box caption is the title parameter from the Microsoft.Web.Management.Client.ModulePageInfo.ModulePageInfo constructor.

Applies to

DisplayErrorMessage(String, String)

Displays a modal dialog box with an error message, based on the specified error text and error message.

protected:
 void DisplayErrorMessage(System::String ^ errorText, System::String ^ errorMessage);
protected void DisplayErrorMessage (string errorText, string errorMessage);
member this.DisplayErrorMessage : string * string -> unit
Protected Sub DisplayErrorMessage (errorText As String, errorMessage As String)

Parameters

errorText
String

The message displayed.

errorMessage
String

The error message to display when errorText is null or empty.

Examples

The following example displays an error message.

DisplayErrorMessage(string.Empty, 
  "My Demo Error Message");

Remarks

The dialog box caption is the title parameter from the Microsoft.Web.Management.Client.ModulePageInfo.ModulePageInfo constructor.

Applies to

DisplayErrorMessage(Exception, ResourceManager, String)

Displays a modal dialog box with an error message, based on the specified exception, resource manager, and caption.

protected:
 void DisplayErrorMessage(Exception ^ ex, System::Resources::ResourceManager ^ resourceManager, System::String ^ caption);
protected void DisplayErrorMessage (Exception ex, System.Resources.ResourceManager resourceManager, string caption);
member this.DisplayErrorMessage : Exception * System.Resources.ResourceManager * string -> unit

Parameters

ex
Exception

The Exception caught.

resourceManager
ResourceManager

The ResourceManager object that is associated with the ModulePage object.

caption
String

The string to display on the dialog box title bar.

Examples

The following example displays an error message.

try {
    Cursor.Current = Cursors.WaitCursor;
    getData();
} catch (WebManagementServiceException wmse) {

    this.DisplayErrorMessage(wmse, _myRM, 
        "My Dialog title/caption string wmse");
} catch (Exception ex) {
    WebManagementServiceException wmse = 
        new WebManagementServiceException(
        "nameErr", "Not Displayed", ex
        );
    this.DisplayErrorMessage(wmse, _myRM);
} finally {
    Cursor.Current = Cursors.Default;
}

Remarks

The DisplayErrorMessage(String, String) overload attempts to cast the ex exception as a Microsoft.Web.Management.Server.WebManagementServiceException object to extract the errorText and errorMessage parameters. If the exception cannot be cast to Microsoft.Web.Management.Server.WebManagementServiceException, errorMessage is set to the exception's System.Exception.Message property and errorText is set to a generic error message.

Applies to

DisplayErrorMessage(String, String, String)

Displays a modal dialog box with an error message, based on the specified error text, error message, and caption.

protected:
 void DisplayErrorMessage(System::String ^ errorText, System::String ^ errorMessage, System::String ^ caption);
protected void DisplayErrorMessage (string errorText, string errorMessage, string caption);
member this.DisplayErrorMessage : string * string * string -> unit
Protected Sub DisplayErrorMessage (errorText As String, errorMessage As String, caption As String)

Parameters

errorText
String

The error text to display.

errorMessage
String

The error message to display when errorText is null or empty.

caption
String

The string to display on the dialog box title bar.

Examples

The following example displays an error message.

this.DisplayErrorMessage("My errorText", "This Does Not Disp",
         "My Caption/Title ");

this.DisplayErrorMessage("", "My Error Message Now Displayed",
     "My Caption/Title ");

Remarks

The errorMessage parameter is displayed only when errorText is null or empty.

Applies to