Share via


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

Switches the current view to the specified view by name.

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

Syntax

'Declaration
Public MustOverride Sub SwitchView ( _
    name As String _
)
'Usage
Dim instance As ViewInfoCollection
Dim name As String

instance.SwitchView(name)
public abstract void SwitchView (
    string name
)

Parameters

  • name
    The name of the view to switch to.

Exceptions

Exception type Condition

ArgumentException

The view name does not exist.

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.

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 view name "View2".

this.ViewInfos.SwitchView("View2");
Me.ViewInfos.SwitchView("View2")

See Also

Reference

ViewInfoCollection Class
ViewInfoCollection Members
Microsoft.Office.InfoPath Namespace