_ButtonEventSink_Event.OnClick Event

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");