Share via


ViewInfoCollection.SwitchView Method (ViewInfo) (Microsoft.Office.InfoPath)

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

  • view
    The ViewObject that represents the view to switch to.

Exceptions

Exception type 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 null.

ArgumentException

The parameter passed to this method isnot 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 Office InfoPath 2007 or in a Web browser.

Example

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
Microsoft.Office.InfoPath Namespace