# Alert Method

Displays a message box with a custom text message in a Microsoft Office InfoPath 2003 form.

expression.Alert(ByVal bstrAlertString As String)

expression Required. An expression that returns a reference to the UI object.

bstrAlertString Required String. The text to be displayed.

## Security Level

2: Can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.

## Remarks

The Alert method displays a simple message box that uses an information icon and an OK button. Only the text in the message box can be customized.

Note Carriage returns can be inserted into the text of the custom message by using the standard `\n` characters.

## Example

In the following example, the Alert method of the UI object is used to display a message box:

    XDocument.UI.Alert("Custom message text goes here.");

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp