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
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.

ControlEvents Class (Microsoft.Office.InfoPath)

Represents the collection of all event handlers for the Clicked events raised by the Button controls on a form.

Namespace: Microsoft.Office.InfoPath
Assembly: Microsoft.Office.InfoPath (in microsoft.office.infopath.dll)

[DefaultMemberAttribute("Item")] 
public abstract class ControlEvents

The ControlEvents class and its Item property are used to bind event handlers in the InternalStartup method of a form template's FormCode class (in the form template's FormCode.cs or FormCode.vb file)

The following example shows the InternalStartup method that binds the event handler for a Button control's Clicked event using the ClickedEventHandler delegate.

ImportantImportant:

The InternalStartup method and the event binding code within it are generated by InfoPath when you add event handlers using various user interface commands. You should not create the InternalStartup method or write any additional code within it yourself. For information about how to add event handlers using interface commands, see How to: Add an Event Handler.

[C#]

public void InternalStartup()

{

((ButtonEvent)EventManager.ControlEvents["MyBtn"]).Clicked +=

new ClickedEventHandler(MyBtn_Clicked);

}

[Visual Basic]

Private Sub InternalStartup(ByVal sender As Object, _

AddHandler DirectCast(EventManager.ControlEvents("MyBtn"), _

ButtonEvent).Clicked, AddressOf MyBtn_Clicked

End Sub

System.Object
  Microsoft.Office.InfoPath.ControlEvents

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

ADD
Show:
© 2015 Microsoft