_XDocumentEventSink2_Event.OnSwitchView Event
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Occurs after a view in a Microsoft InfoPath form has been successfully switched.
public:
event Microsoft::Office::Interop::InfoPath::SemiTrust::_XDocumentEventSink2_OnSwitchViewEventHandler ^ OnSwitchView;
event Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_OnSwitchViewEventHandler OnSwitchView;
member this.OnSwitchView : Microsoft.Office.Interop.InfoPath.SemiTrust._XDocumentEventSink2_OnSwitchViewEventHandler
Event OnSwitchView As _XDocumentEventSink2_OnSwitchViewEventHandler
Event Type
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.<span class="label">OnSwitchView</span>)]
public void OnSwitchView(DocEvent e)
{
thisXDocument.UI.Alert("Loading the view " + thisXDocument.View.Name);
}
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.<span class="label">OnSwitchView</span>)]
public void OnSwitchView(DocEvent e)
{
thisXDocument.UI.Alert("Loading the view " + thisXDocument.View.Name);
}
Remarks
This event handler does not allow users to cancel an operation.
Note: The OnSwitchView event also occurs when a form is first opened.