_ButtonEventSink_Event.OnClick Event

Definition

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

public:
 event Microsoft::Office::Interop::InfoPath::SemiTrust::_ButtonEventSink_OnClickEventHandler ^ OnClick;
event Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_OnClickEventHandler OnClick;
member this.OnClick : Microsoft.Office.Interop.InfoPath.SemiTrust._ButtonEventSink_OnClickEventHandler 
Event OnClick As _ButtonEventSink_OnClickEventHandler 

Event Type

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.<span class="label">OnClick</span>)]
public void btnAlert_<span class="label">OnClick</span>(DocActionEvent e)
 {
  IXMLDOMNode field1;
  field1 = thisXDocument.DOM.selectSingleNode(@"/my:myFields/my:field1");
  thisXDocument.UI.Alert(field1.text);
 }

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.<span class="label">OnClick</span>)]
public void btnAlert_<span class="label">OnClick</span>(DocActionEvent e)
 {
  IXMLDOMNode field1;
  field1 = thisXDocument.DOM.selectSingleNode(@"/my:myFields/my:field1");
  thisXDocument.UI.Alert(field1.text);
 }

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.

Applies to