Item Property (ViewInfos Collection)

Microsoft Office InfoPath

A read-only property that returns a reference to the specified ViewInfo object from the ViewInfos collection.

expression.Item(ByVal varIndex As Variant) As ViewInfo

expression    Required. An expression that returns a reference to the ViewInfos collection.

varIndex Required Variant. An expression that specifies the position of a member of the ViewInfos collection. If a numeric expression, the argument must be a number from 0 to the value of the collection's Count property minus 1. If a string expression, the argument must be the name of a member of the collection.

returns    A reference to a ViewInfo object.

Security Level

0: Can be accessed without restrictions.

Remarks

If the value provided for the varIndex argument does not match any existing member of the collection, an error occurs.

After you have set a reference to the ViewInfo object that the Item property returns, you can access any of its properties.

Example

In the following example, the Item property of the ViewInfos collection is used to return a reference to a ViewInfo object:

var objViewInfo;
objViewInfo = XDocument.ViewInfos.Item(0);

Because the Item property is the default property of the ViewInfos collection, it can also be used as follows:

var objViewInfo;
objViewInfo = XDocument.ViewInfos(0);

You can also use the name of the ViewInfo object, which is the name of a view, as the argument to the Item method, as shown in the following example:

var objViewInfo;
objViewInfo = XDocument.ViewInfos("MyView");