ViewInfos Collection
ViewInfos ViewInfo |
Contains a ViewInfo object for each view within a Microsoft Office InfoPath 2003 form. ViewInfo objects contain descriptive information about the views that they are associated with.
Remarks
The ViewInfos collection implements properties that can be used to access a form's associated ViewInfo objects, and it is accessible through the ViewInfos property of the XDocument object.
Note The ViewInfos collection can be used only to get the count of ViewInfo objects that it contains or to return a reference to a specified ViewInfo object. It cannot be used to create, add, or remove ViewInfo objects.
Using the ViewInfos collection
In the following example, implemented as an OnClick event handler for a button on a form, the ViewInfos property of the XDocument object is used to set a reference to the ViewInfos collection. The code then loops through the collection and displays the positional index and name of each ViewInfo object that it contains.
function ShowViewNames::OnClick(eventObj)
{
// Set a reference to the ViewInfos collection.
var objViewInfos = XDocument.ViewInfos;
// Loop through the collection and display the name
// of each ViewInfo object that it contains.
for (i=0; i < objViewInfos.Count; i++)
{
XDocument.UI.Alert("View name " + i + ": " +
objViewInfos(i).Name);
}
objViewInfos = null;
}
Properties | Count Property (ViewInfos Collection) | Item Property (ViewInfos Collection)