Share via


Window2.Close method (Boolean)

Closes the window that is represented by the WindowObject object.

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

Syntax

'Declaration
Sub Close ( _
    fForce As Boolean _
)
'Usage
Dim instance As Window2
Dim fForce As Boolean

instance.Close(fForce)
void Close(
    bool fForce
)

Parameters

  • fForce
    Type: System.Boolean

    Determines whether open documents will be saved. The default value is false.

Implements

Window.Close(Boolean)

Remarks

The Close method will close the associated window and the forms that it contains. If the bForce parameter is set to true, all forms will be closed without saving, even if they contain changes since they were last saved. If set to false, users will be prompted to save their changes.

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

Note

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

Examples

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

thisApplication.ActiveWindow.Close(false);

See also

Reference

Window2 interface

Window2 members

Close overload

Microsoft.Office.Interop.InfoPath namespace