# Confirm Method

Displays a message box with buttons for input from a user. The value that is returned is one of the XdConfirmChoice enumerated constants.

expression.Confirm(prompt As String, buttons As XdConfirmButtons) As XdConfirmChoice

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

bstrPrompt Required String. The text message to be displayed.

lButtons Required XdConfirmButtons. Specifies the number and type of buttons to display. You may specify any of the values of the XdConfirmButtons enumeration.

## Security

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

Note This object model member is not supported when the Disable Service Pack features option on the Advanced tab of the Options dialog box in InfoPath is selected or when Microsoft Office 2003 Service Pack 1 or later is not installed. Any form that implements this object model member in its code will generate an error message if it is opened in InfoPath when service pack features are disabled or unavailable.

## Remarks

## Example

In the following example, the Confirm method of the UI object is used to display a dialog box with Yes and No buttons:

    XDocument.UI.Confirm("Do you wish to continue?", 4);

©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