ViewInfoCollection class
Contains a ViewInfo object for each view within a form.
Inheritance hierarchy
System.Object
Microsoft.Office.InfoPath.ViewInfoCollection
Namespace: Microsoft.Office.InfoPath
Assembly: Microsoft.Office.InfoPath (in Microsoft.Office.InfoPath.dll)
Syntax
'Declaration
Public MustInherit Class ViewInfoCollection _
Implements IEnumerable
'Usage
Dim instance As ViewInfoCollection
public abstract class ViewInfoCollection : IEnumerable
Remarks
The ViewInfoCollection class implements properties that can be used to access the ViewInfo object associated with each view in a form. The ViewInfoCollection object for a form is accessed through the ViewInfos property of the XmlForm class.
The ViewInfoCollection object can be used to return a reference to a specified ViewInfo object, get the count of the ViewInfo objects, switch views, and return information about a view. It cannot be used to create, add, or remove ViewInfo objects.
Examples
In the following example, the ViewInfos property of the XmlForm class is used to set a reference to the ViewInfoCollection of the form. The code then loops through the collection and uses the HideName property of the ViewInfo class to determine whether the view is hidden from the View menu. If it is, the name of the view is displayed in a message box.
// Set a reference to the ViewInfoCollection of the form.
ViewInfoCollection myViewInfos = this.ViewInfos;
// Loop through the collection and display the
// names of any hidden views.
foreach (ViewInfo myViewInfo in myViewInfos)
{
if(myViewInfo.HideName)
{
MessageBox.Show("Hidden view: " + myViewInfo.Name);
}
}
' Set a reference to the ViewInfoCollection of the form.
Dim myViewInfos As ViewInfoCollection = Me.ViewInfos
' Loop through the collection and display the
' names of any hidden views.
Dim myViewInfo As ViewInfo
For Each myViewInfo In myViewInfos
If myViewInfo.HideName Then
MessageBox.Show("Hidden view: " & myViewInfo.Name)
End If
Next
Thread safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.