_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)

Syntax

'Declaration
Event OnClick As _ButtonEventSink_OnClickEventHandler
'Usage
Dim instance As _ButtonEventSink_Event
Dim handler As _ButtonEventSink_OnClickEventHandler

AddHandler instance.OnClick, handler
event _ButtonEventSink_OnClickEventHandler OnClick

Remarks

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

Note

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

Examples

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

See Also

Reference

_ButtonEventSink_Event Interface

_ButtonEventSink_Event Members

Microsoft.Office.Interop.InfoPath.SemiTrust Namespace