次の方法で共有


DataDOMEvent.NewValue プロパティ

データの入力規則イベントの間に更新または挿入されている XML DOM (Document Object Model) ノードの値を取得します。

このプロパティは、CLS に準拠していません。  

名前空間: Microsoft.Office.Interop.InfoPath.SemiTrust
アセンブリ: Microsoft.Office.Interop.InfoPath.SemiTrust (microsoft.office.interop.infopath.semitrust.dll 内)

構文

'宣言
<DispIdAttribute(7)> _
ReadOnly Property NewValue As Object
'使用
Dim instance As DataDOMEvent
Dim value As Object

value = instance.NewValue
[DispIdAttribute(7)] 
Object NewValue { get; }

コメント

NewValue プロパティには、既存の値を置き換える XML DOM ノードの値が含まれます。XML DOM ノードの元の値を取得するには、OldValue プロパティを使用します。

メモ重要 :

このメンバは、現在開いているフォームと同じドメイン内で実行されているフォーム、またはドメインを越えたアクセス許可を付与されているフォームだけがアクセスできます。

次の例では、DataDOMEventObject オブジェクトの OldValue プロパティを使用して取得した XML DOM ノードの元の値と、その NewValue を表示しています。

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

次の例では、DataDOMEventNewValue プロパティがブランク値かどうかを検査します。ブランクでない場合は、"FirstName" フィールドと "Lastname" フィールドをクリアします。

 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 = "";

関連項目

参照

DataDOMEvent インターフェイス
DataDOMEvent のメンバ
Microsoft.Office.Interop.InfoPath.SemiTrust 名前空間