OnClick Event
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

_ButtonEventSink_Event.OnClick Event

Office 2010

Occurs when a Button control is clicked within a view in a Microsoft InfoPath 2010 form.

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

event _ButtonEventSink_OnClickEventHandler OnClick

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


The OnClick event for the InfoPath button control is the only control event that is supported.

In the following example, the OnClick event handler is used to show the value of my:field1 in an message box:

[InfoPathEventHandler(MatchPath="btnAlert", EventType=InfoPathEventType.OnClick)]
public void btnAlert_OnClick(DocActionEvent e)
  IXMLDOMNode field1;
  field1 = thisXDocument.DOM.selectSingleNode(@"/my:myFields/my:field1");
© 2015 Microsoft