_ExternalApplication2.Quit Method

Definition

Quits the application.

public:
 void Quit();
public void Quit ();
abstract member Quit : unit -> unit
Public Sub Quit ()

Implements

Examples

In the following example, which is written in the C# programming language, the Quit method of the ExternalApplication object is used to close InfoPath:

private void AutomateInfoPathForm()
{
 ExternalApplication infoPath = new ExternalApplicationClass();
 // Open an InfoPath form.
 infoPath.Open(@"C:\My Forms\Form1.xml", 1);

 // Close the InfoPath form.
 infoPath.Close(@"C:\My Forms\Form1.xml");

 // Quit the InfoPath application.
 infoPath.<span class="label">Quit</span>();
}

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 Quit method of the ExternalApplication object is used to close InfoPath:

private void AutomateInfoPathForm()
{
 ExternalApplication infoPath = new ExternalApplicationClass();
 // Open an InfoPath form.
 infoPath.Open(@"C:\My Forms\Form1.xml", 1);

 // Close the InfoPath form.
 infoPath.Close(@"C:\My Forms\Form1.xml");

 // Quit the InfoPath application.
 infoPath.<span class="label">Quit</span>();
}

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

If you use the Close(String) method before using the Quit method, data that has been changed in the form will not be saved, nor will users be prompted to save it. However, if you do not use the Close method but only use the Quit method, users will be prompted to save the form before quitting the InfoPath application.

Important: This member can be accessed only by forms opened from a form template that has been configured to run with full trust using the Security and Trust category of the Form Options dialog box. This member requires full trust for the immediate caller and cannot be used by partially trusted code. For more information, see "Using Libraries from Partially Trusted Code" on MSDN.

Applies to