Window.Close method

Closes the window that is represented by the Window object prompting to save changes to any unsaved form, or form with changes that have not been saved.

Namespace:  Microsoft.Office.InfoPath
Assembly:  Microsoft.Office.InfoPath (in Microsoft.Office.InfoPath.dll)

Syntax

'Declaration
Public MustOverride Sub Close
'Usage
Dim instance As Window

instance.Close()
public abstract void Close()

Remarks

The Close() method will close the associated window and the forms that it contains. If the form has not been saved, or has changes that have not been saved, the user will be prompted to save changes before closing.

The Close method can be used only with the editing window types; if used with a designing window type, it will raise an exception. In addition, the Close method can only be used with the SubmitEventHandler and ClickedEventHandler event handlers. If used with any other type of event handler, it will raise an exception.

Note

If the window being closed is the only window open in Microsoft InfoPath, the InfoPath application will also be closed.

This member 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.

This type or member can be accessed only from code running in forms opened in Microsoft InfoPath Filler.

Examples

In the following example, the Close method of the Window class is used to close the currently active window, forcing a save if changes in the form have occurred.

this.Application.ActiveWindow.Close();
Me.Application.ActiveWindow.Close()

See also

Reference

Window class

Window members

Close overload

Microsoft.Office.InfoPath namespace