Window2.Close Method (Boolean)
Closes the window that is represented by the WindowObject object.
Namespace: Microsoft.Office.Interop.InfoPath.SemiTrust
Assembly: Microsoft.Office.Interop.InfoPath.SemiTrust (in Microsoft.Office.Interop.InfoPath.SemiTrust.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.BooleanDetermines whether open documents will be saved. The default value is false.
Implements
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 InfoPath 2010, the InfoPath application will also be closed.
Important
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.
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);