_XDocumentEventSink2_Event.OnSwitchView Event

Occurs after a view in a Microsoft InfoPath 2010 form has been successfully switched.

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

Syntax

'Declaration
Event OnSwitchView As _XDocumentEventSink2_OnSwitchViewEventHandler
'Usage
Dim instance As _XDocumentEventSink2_Event
Dim handler As _XDocumentEventSink2_OnSwitchViewEventHandler

AddHandler instance.OnSwitchView, handler
event _XDocumentEventSink2_OnSwitchViewEventHandler OnSwitchView

Remarks

This event handler does not allow users to cancel an operation.

Note

The OnSwitchView event also occurs when a form is first opened.

Examples

In the following example, the OnSwitchView event handler is used to show the name of the view displayed when the view change occurs:

[InfoPathEventHandler(EventType=InfoPathEventType.OnSwitchView)]
public void OnSwitchView(DocEvent e)
{
 thisXDocument.UI.Alert("Loading the view " + thisXDocument.View.Name);
}

See Also

Reference

_XDocumentEventSink2_Event Interface

_XDocumentEventSink2_Event Members

Microsoft.Office.Interop.InfoPath.SemiTrust Namespace