Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

_ButtonEventSink_Event.OnClick event

Occurs when a Button control is clicked within a view in a Microsoft InfoPath 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.

NoteNote

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");
  thisXDocument.UI.Alert(field1.text);
 }
Show:
© 2015 Microsoft