Share via


XmlEvent.Changed Event

Occurs after changes to a form's underlying XML document have been accepted and after the Validating event has occurred.

Namespace:  Microsoft.Office.InfoPath
Assembly:  Microsoft.Office.InfoPath (in Microsoft.Office.InfoPath.dll)

Syntax

'Declaration
Public MustOverride Event Changed As XmlChangedEventHandler
'Usage
Dim instance As XmlEvent
Dim handler As XmlChangedEventHandler

AddHandler instance.Changed, handler
public abstract event XmlChangedEventHandler Changed

Exceptions

Exception Condition
InvalidOperationException

The developer attempted to bind the event in some location other than the InternalStartup method.

Remarks

Important

The Changed event is not meant to be instantiated by the developer in form code. When you add an event handler to your form template from the design mode user interface, Microsoft InfoPath 2010 generates code in the InternalStartup method of your form code file using the EventManager class and the member of the XmlEvent class to bind document-level events to their event handlers. For information on how to add event handlers in InfoPath design mode, see How to: Add an Event Handler.

The Changed event is bound using the XmlChangedEventHandler delegate.

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

The Change event is typically used for changing data in a form after other changes have occurred, such as making calculations or changing the structure of a form's underlying XML document.

This type or member can be accessed from code running in forms opened in Microsoft InfoPath Filler or in a Web browser.

Examples

In the following example, after a change has been made and validated for field9, a value is added to field4 to reflect this change.

public void field9_Changed(object sender, XmlEventArgs e)
{
   this.CreateNavigator().SelectSingleNode("/my:myFields/my:field4", 
      this.NamespaceManager).SetValue("Field9 was changed.");
}
Public Sub field9_Changed(ByVal sender As Object, _
   ByVal e As XmlEventArgs )
   Me.CreateNavigator().SelectSingleNode("/my:myFields/my:field4", _
      Me.NamespaceManager).SetValue("Field9 was changed.")
End Sub

See Also

Reference

XmlEvent Class

XmlEvent Members

Microsoft.Office.InfoPath Namespace