|InfoPath Developer Reference|
Version Added: InfoPath 2003
expression An expression that returns a XDocuments object.
|varIndex||Required||Variant||The string value that specifies the Uniform Resource Identifier (URI) of a form, a long integer value that specifies the positional index of an XDocument object within the XDocuments collection, or a reference to an XDocument object.|
The Close method closes the currently open form without quitting the InfoPath application. The form is closed unconditionally, meaning that any changes made to the data in the form are not saved.
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.
In the following example, the Close method of the XDocuments collection is used to close the currently open form using the positional index of an XDocument object contained in the collection:
Alternatively, you can pass a reference to an XDocument object: