The Windows collection implements a set of properties that provide access to the Windows object associated with the current solution. The properties are shown in Table A.2.
Name | Security Level | Description |
---|---|---|
Count Property | 1 | Returns a count of the total number of Window objects contained in the collection |
Item Property | 1 | Returns a reference to the specified Window property |
InfoPath provides two types of application windows. The first is the editing window, which you use when filling out a form. The second is the design window, which form developers use. Listing A.1 loops through the entire Windows collection and displays the window type.
// Set the reference to the Windows collection. var objWindows = Application.Windows; var strWType; // show the count of windows XDocument.UI.Alert("There are " + objWindows.Count + " open for this solution") // Look through the collection for (i=0; i < objWindows.Count; i++) { switch (objWindows(i).Type) { case 0: strWType = "Editing window"; break; case 1: strWType = "Designer window"; break; } XDocument.UI.Alert("Window type " + i + ": " + strWType); } objWindows = null; strWType = null;
Note | The Windows collection does not allow you to create, add, or remove specific Window objects. |