Windows Collection

InfoPath Developer Reference

Contains a Window object for each window within a Microsoft Office InfoPath 2007 form.

Version Information
 Version Added:  InfoPath 2003

Remarks

Window objects represent the two types of windows that are used in the InfoPath application: the editing window that is used as the form area when a user fills out a form, and the designing window that is used as the design mode when a user designs a form.

The Windows collection implements properties that can be used to access a form's associated Window objects, and it is accessible through the Windows property of the Application object.

Bb229719.vs_note(en-us,office.12).gif  Note
The Windows collection can be used only to get the count of Window objects that it contains or to return a reference to a specified Window object. It cannot be used to create, add, or remove Window objects.

For more information about using the Windows collection, see Working with form windows.

Example

In the following example, implemented as an OnClick event handler for a button on a form, the Windows property of the Application object is used to set a reference to the Windows collection. The code then loops through the collection and displays the type of each Window object that it contains.

JScript
  function ShowWindowTypes::OnClick(eventObj)
{
   // Set a reference to the Windows collection.
   var objWindows = Application.Windows;
   var strWindowType;

// Loop through the collection and display the type // of each Window object that it contains. for (i=0; i < objWindows.Count; i++) { switch (objWindows(i).Type) { case 0: strWindowType = "Editing window"; break; case 1: strWindowType = "Designing window"; break; }

  XDocument.UI.Alert("Window type " + i + ": " + strWindowType);

} objWindows = null; strWindowType = null; }

See Also