ViewInfoCollection Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Contains a ViewInfo object for each view within a form.
public ref class ViewInfoCollection abstract : System::Collections::IEnumerable
public abstract class ViewInfoCollection : System.Collections.IEnumerable
type ViewInfoCollection = class
interface IEnumerable
Public MustInherit Class ViewInfoCollection
Implements IEnumerable
- Inheritance
-
ViewInfoCollection
- Implements
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
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.
Constructors
ViewInfoCollection() |
Properties
Count |
Gets a count of the number of ViewInfo objects contained in the ViewInfoCollection collection. |
Default |
Gets a ViewInfo object that represents the default view as it is set in the form template. |
Initial |
Gets or sets the ViewInfo object that represents the initial view of the form. |
Item[Int32] |
Gets the specified ViewInfo object from the ViewInfoCollection collection by index value. |
Item[String] |
Gets the specified ViewInfo object from the ViewInfoCollection collection by name. |
Methods
GetEnumerator() |
Gets an IEnumerator object that iterates over all entries in the ViewInfoCollection object. |
SwitchView(String) |
Switches the current view to the specified view by name. |
SwitchView(ViewInfo) |
Switches the current view to the view represented by the specified ViewInfo object. |