Edytuj

Udostępnij za pośrednictwem


DataDOMEventObject Interface

Definition

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

public interface class DataDOMEventObject : Microsoft::Office::Interop::InfoPath::DataDOMEvent
[System.Runtime.InteropServices.Guid("096CD5E5-0786-11D1-95FA-0080C78EE3BB")]
public interface DataDOMEventObject : Microsoft.Office.Interop.InfoPath.DataDOMEvent
type DataDOMEventObject = interface
    interface DataDOMEvent
Public Interface DataDOMEventObject
Implements DataDOMEvent
Derived
Attributes
Implements

Examples

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(Object, String, Boolean, String, Int32, String) method is used to create a custom error.

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

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

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.

Properties

IsUndoRedo

Gets a value indicating whether the data validation event occurs during an undo operation or a redo operation.

(Inherited from DataDOMEvent)
MatchExpression

Gets the XPath expression for the XML Document Object Model (DOM) node for which the event is currently being processed.

(Inherited from DataDOMEvent)
NewValue

Gets the value of an XML Document Object Model (DOM) node that is being updated or inserted during a data validation event.

(Inherited from DataDOMEvent)
OldValue

Gets the original value of an XML Document Object Model (DOM) node that is being updated or deleted during a data validation event.

(Inherited from DataDOMEvent)
Operation

Gets the type of action that is applied to an XML Document Object Model (DOM) node during a data validation event.

(Inherited from DataDOMEvent)
Parent

Gets a reference to the XML Document Object Model (DOM) node of the parent of the XML DOM node being changed during a data validation event.

(Inherited from DataDOMEvent)
ReturnMessage

Gets or sets the error message that will be returned if the data validation event is not successful.

(Inherited from DataDOMEvent)
ReturnStatus

Gets or sets a value indicating the return status of the data validation event.

(Inherited from DataDOMEvent)
Site

Gets a reference to the XML Document Object Model (DOM) node where the data validation event is currently being processed.

(Inherited from DataDOMEvent)
Source

Gets a reference to the XML Document Object Model (DOM) where the data validation event is occurring.

(Inherited from DataDOMEvent)
XDocument

Gets a reference to the XDocument object that is associated with the DataDOMEventObject object during a data validation event.

(Inherited from DataDOMEvent)

Methods

ReportError(Object, String, Boolean, String, Int32, String)

Creates an ErrorObject object and adds it to the ErrorsCollection collection.

(Inherited from DataDOMEvent)

Applies to