ViewInfo Object

Microsoft Office InfoPath

ViewInfo Object

ViewInfos ViewInfo

Contains descriptive information about a view within a Microsoft Office InfoPath 2003 form.

Remarks

The ViewInfo object provides properties that can be used to get the name of a view and determine whether a view is the default view of the form. The ViewInfo object is accessible through the ViewInfos property of the XDocument object.

Note  To work with the view programmatically, use the View object.

Using the ViewInfo object

In the following example, the IsDefault property of the ViewInfo object is used to determine whether a view is the default view of the form. Then the code uses the Name property of the ViewInfo object to display the name of the default view in a message box.

    var objViewInfos;

// Set a reference to the ViewInfos collection.
objViewInfos = XDocument.ViewInfos;

// Determine the default view and display a 
// message box with its name.
for (i=0; i < objViewInfos.Count; i++)
{
   if (objViewInfos(i).IsDefault)
      XDocument.UI.Alert("The default view is: " + XDocument.ViewInfos(0).Name);
}