Share via


DataDOMEventObject Interface

An event object that is used during Microsoft Office InfoPath 2007 data validation events.

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

Syntax

'Declaration
'Usage

Remarks

This type is a wrapper for a coclass that is required by managed code for COM interoperability. Use this type to access the members of the COM interface implemented by this coclass. For information about the COM interface, including a link to descriptions of its members, see DataDOMEvent.

The DataDOMEvent object provides a number of properties and a method that can be used within a data validation event to programmatically interact with the data that is being validated and to provide a response if the data is not valid.

The DataDOMEvent object is passed as a parameter to the OnBeforeChange, the OnValidate, and the OnAfterChange events

Note

The OnValidate event can occur without a change in the form's underlying XML document.

The DataDOMEvent object is used to get information about the XML Document Object Model (DOM) node that is being changed, and it also provides a property for getting a reference to a form's underlying XML document. In addition, it provides properties for handling the change in data, including rejecting the change and creating an error message.

Note

The DataDOMEvent object is passed as an argument to one of the data validation event handlers. Its properties and method are only available during the event that it is passed to.

Example

In the following example, the DataDOMEvent object is used to check the value of the node using the Site property. If the data validation fails, the ReportError method is used to create a custom error.

public void field1_OnValidate(DataDOMEvent e)
{
 if(e.Site.text != "")
 {
  int quantity = int.Parse(e.Site.text.ToString());
  if(quantity > 50)
  {
   e.ReportError(e.Site, "Invalid quantity. The total number of each type of block cannot exceed 50.", false, "", 2,"modeless");
  }
  if(quantity < 0)
  {
   e.ReportError(e.Site, "Invalid quantity. The total number of each type of block cannot be less than 0.", false,"", 2,"modeless");
  }
 }
}

See Also

Reference

DataDOMEventObject Members
Microsoft.Office.Interop.InfoPath Namespace