Düzenle

Aracılığıyla paylaş


_ExternalApplication.Close(String) Method

Definition

Closes the specified Microsoft InfoPath form.

public:
 void Close(System::String ^ bstrDocumentURI);
public void Close (string bstrDocumentURI);
abstract member Close : string -> unit
Public Sub Close (bstrDocumentURI As String)

Parameters

bstrDocumentURI
String

The string value that specifies the Uniform Resource Identifier (URI) of a form.

Examples

In the following example, which is written in the C# programming language, the Close method of the ExternalApplication object is used to close the currently open form:

private void AutomateInfoPathForm()
{
 ExternalApplication infoPath = new ExternalApplicationClass();
 // Open an InfoPath form.
 infoPath.Open(@"C:\My Forms\Form1.xml", 1);
 // Close the InfoPath form.
 infoPath.<span class="label">Close</span>(@"C:\My Forms\Form1.xml");
 // Quit the InfoPath application.
 infoPath.Quit();
}

Note: The above example assumes that the Microsoft.Office.Interop.InfoPath namespace is being used and that the Microsoft InfoPath 3.0 Type Library is referenced.

In the following example, which is written in the C# programming language, the Close method of the ExternalApplication object is used to close the currently open form:

private void AutomateInfoPathForm()
{
 ExternalApplication infoPath = new ExternalApplicationClass();
 // Open an InfoPath form.
 infoPath.Open(@"C:\My Forms\Form1.xml", 1);
 // Close the InfoPath form.
 infoPath.<span class="label">Close</span>(@"C:\My Forms\Form1.xml");
 // Quit the InfoPath application.
 infoPath.Quit();
}

Note: The above example assumes that the Microsoft.Office.Interop.InfoPath namespace is being used and that the Microsoft InfoPath 3.0 Type Library is referenced.

Remarks

The Close method closes the currently open form without quitting the InfoPath application. When using the Close method, the form is closed unconditionally, meaning that any changes made to the data in the form are not saved.

Applies to