ViewInfoCollection.SwitchView method (ViewInfo)

Switches the current view to the view represented by the specified ViewInfo object.

Namespace:  Microsoft.Office.InfoPath
Assembly:  Microsoft.Office.InfoPath (in Microsoft.Office.InfoPath.dll)

Syntax

'Declaration
Public MustOverride Sub SwitchView ( _
    view As ViewInfo _
)
'Usage
Dim instance As ViewInfoCollection
Dim view As ViewInfo

instance.SwitchView(view)
public abstract void SwitchView(
    ViewInfo view
)

Parameters

Exceptions

Exception Condition
InvalidOperationException

The SwitchView method was called from an event handler for the Loading or ViewSwitched events.

ArgumentNullException

The parameter passed to this method is a null reference (Nothing in Visual Basic).

ArgumentException

The parameter passed to this method is not valid. For example, it is of the wrong type or format.

Remarks

This member can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.

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

Examples

The following example switches the current view to the initial view in the ViewInfoCollection collection using the Initial property to get the ViewInfo object that represents the initial view in the collection.

ViewInfo firstView = ViewInfos.Initial;
this.ViewInfos.SwitchView(firstView);
Dim firstView As ViewInfo  = ViewInfos.Initial
Me.ViewInfos.SwitchView(firstView)

See also

Reference

ViewInfoCollection class

ViewInfoCollection members

SwitchView overload

Microsoft.Office.InfoPath namespace