We recommend using Visual Studio 2017

ViewInfoCollection.Item Property (String) (Microsoft.Office.InfoPath)

Gets the specified ViewInfo object from the ViewInfoCollection collection by name.

Namespace: Microsoft.Office.InfoPath
Assembly: Microsoft.Office.InfoPath (in microsoft.office.infopath.dll)

public abstract ViewInfo this [
	string viewName
] { get; }

Parameters

viewName

The name of the ViewInfo object to get.

Property Value

A ViewInfo object from the ViewInfoCollection collection that corresponds to the specified name.

Exception typeCondition

ArgumentException

The specified view name doesn't exist, or a null or empty value was passed.

This member can be accessed without restrictions.

This type or member can be accessed from code running in forms opened in Microsoft Office InfoPath 2007 or in a Web browser.

The following example sets a variable to the ViewInfo object with the name "View2".

ViewInfo myView = this.ViewInfos["View2"];
Show: