# MessageBox

Namespace: **Wisej.Web**

Assembly: **Wisej.Framework** (4.0.0.0)

* [Component](/api/wisej.base/general/wisej.base.component.md)
  * [MessageBox](/api/wisej.web/notifications/messagebox.md)

Displays a message box that can contain text, buttons, and symbols that inform and instruct the user.

{% tabs %}
{% tab title="C#" %}

```csharp
public class MessageBox : Component
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class MessageBox
    Inherits Component
```

{% endtab %}
{% endtabs %}

## Methods

### ![](/files/lzopMboA31bVq8UIcbT3) Dispose(disposing)

Frees resources related to this component.

| Parameter     | Type                                                            | Description                                                                 |
| ------------- | --------------------------------------------------------------- | --------------------------------------------------------------------------- |
| **disposing** | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean) | true when this method is called by the application rather than a finalizer. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnWebEvent(e)

Processes the event from the client.

| Parameter | Type                                                        | Description      |
| --------- | ----------------------------------------------------------- | ---------------- |
| **e**     | [WisejEventArgs](/api/wisej.core/general/wisejeventargs.md) | Event arguments. |

### ![](/files/lzopMboA31bVq8UIcbT3) OnWebRender(config)

Renders the client component.

| Parameter  | Type                                                          | Description                   |
| ---------- | ------------------------------------------------------------- | ----------------------------- |
| **config** | [Object](https://docs.microsoft.com/dotnet/api/system.object) | Dynamic configuration object. |

### ![](/files/lIX317sDtMTZJBi9oSIx) Show(text, caption, buttons, icon, defaultButton, modal, allowHtml, keepOnScreen, rightToLeft, onclose)

Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button.

| Parameter                                          | Type                                                                                                    | Description                                                                                                                                                                                         |
| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **text**                                           | [String](https://docs.microsoft.com/dotnet/api/system.string)                                           | The text to display in the message box. Newlines (CRLF) are converted to \<BR/> when the text doesn't contain any html.                                                                             |
| **caption** ![](/files/1vGqtbG2j637vQ4ROWOf)       | [String](https://docs.microsoft.com/dotnet/api/system.string)                                           | The text to display in the title bar of the message box.                                                                                                                                            |
| **buttons** ![](/files/1vGqtbG2j637vQ4ROWOf)       | [MessageBoxButtons](/api/wisej.web/notifications/messagebox/wisej.web.messageboxbuttons.md)             | One of the [MessageBoxButtons](/api/wisej.web/notifications/messagebox/wisej.web.messageboxbuttons.md) values that specifies which buttons to display in the message box.                           |
| **icon** ![](/files/1vGqtbG2j637vQ4ROWOf)          | [MessageBoxIcon](/api/wisej.web/notifications/alertbox/wisej.web.messageboxicon.md)                     | One of the [MessageBoxIcon](/api/wisej.web/notifications/alertbox/wisej.web.messageboxicon.md) values that specifies which icon to display in the message box.                                      |
| **defaultButton** ![](/files/1vGqtbG2j637vQ4ROWOf) | [MessageBoxDefaultButton](/api/wisej.web/notifications/messagebox/wisej.web.messageboxdefaultbutton.md) | One of the [MessageBoxDefaultButton](/api/wisej.web/notifications/messagebox/wisej.web.messageboxdefaultbutton.md) values that specifies the default button for the message box.                    |
| **modal** ![](/files/1vGqtbG2j637vQ4ROWOf)         | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                                         | Indicates whether the message box is modal and waits for the user response before resuming execution. When set to false, the return value is always DialogResult.None. The default is true - modal. |
| **allowHtml** ![](/files/1vGqtbG2j637vQ4ROWOf)     | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                                         | Allows the message text to include HTML code.                                                                                                                                                       |
| **keepOnScreen** ![](/files/1vGqtbG2j637vQ4ROWOf)  | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                                         | Keeps the message box in the viewable area when being moved by the user. The default is false.                                                                                                      |
| **rightToLeft** ![](/files/1vGqtbG2j637vQ4ROWOf)   | [RightToLeft](/api/wisej.web/enumerations/wisej.web.righttoleft.md)                                     | Indicates whether the dialog box should display it's content right aligned.                                                                                                                         |
| **onclose** ![](/files/1vGqtbG2j637vQ4ROWOf)       | [Action\<DialogResult>](https://docs.microsoft.com/dotnet/api/system.action-1)                          | Optional async handler for the close event; called when the MessageBox has been closed.                                                                                                             |

**Returns:** [DialogResult](/api/wisej.web/enumerations/wisej.web.dialogresult.md). One of the [DialogResult](/api/wisej.web/enumerations/wisej.web.dialogresult.md) values.

### ![](/files/lIX317sDtMTZJBi9oSIx) Show(owner, text, caption, buttons, icon, defaultButton, modal, allowHtml, keepOnScreen, rightToLeft, onclose)

Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button.

| Parameter                                          | Type                                                                                                    | Description                                                                                                                                                                                        |
| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **owner**                                          | [Form](/api/wisej.web/containers/form.md)                                                               | An implementation of [Form](/api/wisej.web/containers/form.md) that owns the modal dialog box.                                                                                                     |
| **text**                                           | [String](https://docs.microsoft.com/dotnet/api/system.string)                                           | The text to display in the message box. Newlines (CRLF) are converted to \<BR/> when the text doesn't contain any html.                                                                            |
| **caption** ![](/files/1vGqtbG2j637vQ4ROWOf)       | [String](https://docs.microsoft.com/dotnet/api/system.string)                                           | The text to display in the title bar of the message box.                                                                                                                                           |
| **buttons** ![](/files/1vGqtbG2j637vQ4ROWOf)       | [MessageBoxButtons](/api/wisej.web/notifications/messagebox/wisej.web.messageboxbuttons.md)             | One of the [MessageBoxButtons](/api/wisej.web/notifications/messagebox/wisej.web.messageboxbuttons.md) values that specifies which buttons to display in the message box.                          |
| **icon** ![](/files/1vGqtbG2j637vQ4ROWOf)          | [MessageBoxIcon](/api/wisej.web/notifications/alertbox/wisej.web.messageboxicon.md)                     | One of the [MessageBoxIcon](/api/wisej.web/notifications/alertbox/wisej.web.messageboxicon.md) values that specifies which icon to display in the message box.                                     |
| **defaultButton** ![](/files/1vGqtbG2j637vQ4ROWOf) | [MessageBoxDefaultButton](/api/wisej.web/notifications/messagebox/wisej.web.messageboxdefaultbutton.md) | One of the [MessageBoxDefaultButton](/api/wisej.web/notifications/messagebox/wisej.web.messageboxdefaultbutton.md) values that specifies the default button for the message box.                   |
| **modal** ![](/files/1vGqtbG2j637vQ4ROWOf)         | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                                         | Indicates whether the dialog box is modal and waits for the user response before resuming execution. When set to false, the return value is always DialogResult.None. The default is true - modal. |
| **allowHtml** ![](/files/1vGqtbG2j637vQ4ROWOf)     | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                                         | Allows the message text to include HTML code.                                                                                                                                                      |
| **keepOnScreen** ![](/files/1vGqtbG2j637vQ4ROWOf)  | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                                         | Keeps the message box in the viewable area when being moved by the user. The default is false.                                                                                                     |
| **rightToLeft** ![](/files/1vGqtbG2j637vQ4ROWOf)   | [RightToLeft](/api/wisej.web/enumerations/wisej.web.righttoleft.md)                                     | Indicates whether the dialog box should display it's content right aligned.                                                                                                                        |
| **onclose** ![](/files/1vGqtbG2j637vQ4ROWOf)       | [Action\<DialogResult>](https://docs.microsoft.com/dotnet/api/system.action-1)                          | Optional async handler for the close event; called when the MessageBox has been closed.                                                                                                            |

**Returns:** [DialogResult](/api/wisej.web/enumerations/wisej.web.dialogresult.md). One of the [DialogResult](/api/wisej.web/enumerations/wisej.web.dialogresult.md) values.

### ![](/files/lIX317sDtMTZJBi9oSIx) ShowAsync(text, caption, buttons, icon, defaultButton, modal, allowHtml, keepOnScreen, rightToLeft)

Asynchronously displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button.

| Parameter                                          | Type                                                                                                    | Description                                                                                                                                                                                        |
| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **text**                                           | [String](https://docs.microsoft.com/dotnet/api/system.string)                                           | The text to display in the message box. Newlines (CRLF) are converted to \<BR/> when the text doesn't contain any html.                                                                            |
| **caption** ![](/files/1vGqtbG2j637vQ4ROWOf)       | [String](https://docs.microsoft.com/dotnet/api/system.string)                                           | The text to display in the title bar of the message box.                                                                                                                                           |
| **buttons** ![](/files/1vGqtbG2j637vQ4ROWOf)       | [MessageBoxButtons](/api/wisej.web/notifications/messagebox/wisej.web.messageboxbuttons.md)             | One of the [MessageBoxButtons](/api/wisej.web/notifications/messagebox/wisej.web.messageboxbuttons.md) values that specifies which buttons to display in the message box.                          |
| **icon** ![](/files/1vGqtbG2j637vQ4ROWOf)          | [MessageBoxIcon](/api/wisej.web/notifications/alertbox/wisej.web.messageboxicon.md)                     | One of the [MessageBoxIcon](/api/wisej.web/notifications/alertbox/wisej.web.messageboxicon.md) values that specifies which icon to display in the message box.                                     |
| **defaultButton** ![](/files/1vGqtbG2j637vQ4ROWOf) | [MessageBoxDefaultButton](/api/wisej.web/notifications/messagebox/wisej.web.messageboxdefaultbutton.md) | One of the [MessageBoxDefaultButton](/api/wisej.web/notifications/messagebox/wisej.web.messageboxdefaultbutton.md) values that specifies the default button for the message box.                   |
| **modal** ![](/files/1vGqtbG2j637vQ4ROWOf)         | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                                         | Indicates whether the dialog box is modal and waits for the user response before resuming execution. When set to false, the return value is always DialogResult.None. The default is true - modal. |
| **allowHtml** ![](/files/1vGqtbG2j637vQ4ROWOf)     | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                                         | Allows the message text to include HTML code.                                                                                                                                                      |
| **keepOnScreen** ![](/files/1vGqtbG2j637vQ4ROWOf)  | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                                         | Keeps the message box in the viewable area when being moved by the user. The default is false.                                                                                                     |
| **rightToLeft** ![](/files/1vGqtbG2j637vQ4ROWOf)   | [RightToLeft](/api/wisej.web/enumerations/wisej.web.righttoleft.md)                                     | Indicates whether the dialog box should display it's content right aligned.                                                                                                                        |

**Returns:** [Task\<DialogResult>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). One of the [DialogResult](/api/wisej.web/enumerations/wisej.web.dialogresult.md) values.

### ![](/files/lIX317sDtMTZJBi9oSIx) ShowAsync(owner, text, caption, buttons, icon, defaultButton, modal, allowHtml, keepOnScreen, rightToLeft)

Asynchronously displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button.

| Parameter                                          | Type                                                                                                    | Description                                                                                                                                                                                        |
| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **owner**                                          | [Form](/api/wisej.web/containers/form.md)                                                               | An implementation of [Form](/api/wisej.web/containers/form.md) that owns the modal dialog box.                                                                                                     |
| **text**                                           | [String](https://docs.microsoft.com/dotnet/api/system.string)                                           | The text to display in the message box. Newlines (CRLF) are converted to \<BR/> when the text doesn't contain any html.                                                                            |
| **caption** ![](/files/1vGqtbG2j637vQ4ROWOf)       | [String](https://docs.microsoft.com/dotnet/api/system.string)                                           | The text to display in the title bar of the message box.                                                                                                                                           |
| **buttons** ![](/files/1vGqtbG2j637vQ4ROWOf)       | [MessageBoxButtons](/api/wisej.web/notifications/messagebox/wisej.web.messageboxbuttons.md)             | One of the [MessageBoxButtons](/api/wisej.web/notifications/messagebox/wisej.web.messageboxbuttons.md) values that specifies which buttons to display in the message box.                          |
| **icon** ![](/files/1vGqtbG2j637vQ4ROWOf)          | [MessageBoxIcon](/api/wisej.web/notifications/alertbox/wisej.web.messageboxicon.md)                     | One of the [MessageBoxIcon](/api/wisej.web/notifications/alertbox/wisej.web.messageboxicon.md) values that specifies which icon to display in the message box.                                     |
| **defaultButton** ![](/files/1vGqtbG2j637vQ4ROWOf) | [MessageBoxDefaultButton](/api/wisej.web/notifications/messagebox/wisej.web.messageboxdefaultbutton.md) | One of the [MessageBoxDefaultButton](/api/wisej.web/notifications/messagebox/wisej.web.messageboxdefaultbutton.md) values that specifies the default button for the message box.                   |
| **modal** ![](/files/1vGqtbG2j637vQ4ROWOf)         | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                                         | Indicates whether the dialog box is modal and waits for the user response before resuming execution. When set to false, the return value is always DialogResult.None. The default is true - modal. |
| **allowHtml** ![](/files/1vGqtbG2j637vQ4ROWOf)     | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                                         | Allows the message text to include HTML code.                                                                                                                                                      |
| **keepOnScreen** ![](/files/1vGqtbG2j637vQ4ROWOf)  | [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean)                                         | Keeps the message box in the viewable area when being moved by the user. The default is false.                                                                                                     |
| **rightToLeft** ![](/files/1vGqtbG2j637vQ4ROWOf)   | [RightToLeft](/api/wisej.web/enumerations/wisej.web.righttoleft.md)                                     | Indicates whether the dialog box should display it's content right aligned.                                                                                                                        |

**Returns:** [Task\<DialogResult>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). One of the [DialogResult](/api/wisej.web/enumerations/wisej.web.dialogresult.md) values.

## Implements

| Name                                                                              | Description                                                                                                     |
| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| [IUserData](/api/wisej.web/interfaces/wisej.web.iuserdata.md)                     | Provides access to the `UserData` and `Tag` properties associated to the component implementing this interface. |
| [IWisejComponent](/api/wisej.core/interfaces/wisej.core.iwisejcomponent.md)       | All wisej components implement this interface.                                                                  |
| [IWisejSerializable](/api/wisej.core/interfaces/wisej.core.iwisejserializable.md) | Allows an object to serialize itself.                                                                           |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/api/wisej.web/notifications/messagebox.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
