ViewInfoCollection.SwitchView Method

Definition

Overloads

SwitchView(ViewInfo)

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

SwitchView(String)

Switches the current view to the specified view by name.

SwitchView(ViewInfo)

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

public:
 abstract void SwitchView(Microsoft::Office::InfoPath::ViewInfo ^ view);
public abstract void SwitchView (Microsoft.Office.InfoPath.ViewInfo view);
abstract member SwitchView : Microsoft.Office.InfoPath.ViewInfo -> unit
Public MustOverride Sub SwitchView (view As ViewInfo)

Parameters

view
ViewInfo

The ViewObject that represents the view to switch to.

Exceptions

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

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

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

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)

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.

Applies to

SwitchView(String)

Switches the current view to the specified view by name.

public:
 abstract void SwitchView(System::String ^ name);
public abstract void SwitchView (string name);
abstract member SwitchView : string -> unit
Public MustOverride Sub SwitchView (name As String)

Parameters

name
String

The name of the view to switch to.

Exceptions

The view name does not exist.

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

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

Examples

The following example switches the current view to the view name "View2".

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

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.

Applies to