DataDOMEvent.NewValue Property

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

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

Syntax

'Declaration
ReadOnly Property NewValue As Object
    Get
'Usage
Dim instance As DataDOMEvent
Dim value As Object

value = instance.NewValue
Object NewValue { get; }

Property Value

Type: System.Object

Remarks

The NewValue property contains the value of the XML DOM node that will replace the existing value. To get the original value of the XML DOM node, use the OldValue property.

Important

This member can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.

Examples

In the following example, the OldValue property of the DataDOMEventObject object is used to display the original value of an XML DOM node, along with its NewValue:

thisXDocument.UI.Alert("Original value: " + e.OldValue.ToString() + "\nNew value: " + e.NewValue.ToString());

In the following example, the NewValue property of the DataDOMEvent is checked for a blank value. If not blank, the "FirstName" and "Lastname" fields are cleared.

 if (e.IsUndoRedo)
 {
  // An undo or redo operation has occurred and the DOM is read-only.
  return;
 }

 // A field change has occurred and the DOM is writable. Write code here to respond
 // to the changes.
 if (e.NewValue.ToString() == "")
 return;

 if (thisXDocument.DOM.selectSingleNode("/dfs:myFields/dfs:queryFields/q:Employees/@FirstName").text != "")
thisXDocument.DOM.selectSingleNode("/dfs:myFields/dfs:queryFields/q:Employees/@FirstName").text = "";

 if (thisXDocument.DOM.selectSingleNode("/dfs:myFields/dfs:queryFields/q:Employees/@LastName").text != "")
thisXDocument.DOM.selectSingleNode("/dfs:myFields/dfs:queryFields/q:Employees/@LastName").text = "";

See Also

Reference

DataDOMEvent Interface

DataDOMEvent Members

Microsoft.Office.Interop.InfoPath.SemiTrust Namespace