Udostępnij za pośrednictwem


XMLNode.ValidationErrorText Property (2007 System)

Gets a string that represents the description for a validation error on an XMLNode control.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property ValidationErrorText As XMLNode._ValidationErrorTextType
'Usage
Dim instance As XMLNode 
Dim value As XMLNode._ValidationErrorTextType 

value = instance.ValidationErrorText
[BrowsableAttribute(false)]
public XMLNode._ValidationErrorTextType ValidationErrorText { get; }
[BrowsableAttribute(false)]
public:
property XMLNode._ValidationErrorTextType^ ValidationErrorText {
    XMLNode._ValidationErrorTextType^ get ();
}
public function get ValidationErrorText () : XMLNode._ValidationErrorTextType

Property Value

Type: Microsoft.Office.Tools.Word.XMLNode._ValidationErrorTextType
A string that represents the description for a validation error on an XMLNode control.

Remarks

The ValidationErrorText property is intended to be used with the following parameter.

Parameter

Description

Advanced

true to display the advanced version of the validation error description, which comes from the MSXML 5.0 component included with Microsoft Office Word; otherwise, false.

If you attempt to use ValidationErrorText without specifying a parameter, ValidationErrorText will get a XMLNode._ValidationErrorTextType object that is part of the Visual Studio Tools for Office infrastructure and is not intended to be used directly from your code.

Optional Parameters

For information on optional parameters, see The Variable missing and Optional Parameters in Office Solutions.

Examples

The following code example sets the text value of an XMLNode and validates the node by using the Validate method. The example then uses the ValidationStatus property to determine whether the node validated. If the node did not validate, then the example uses the ValidationErrorText property to display the validation error message. This example assumes that the current document contains an XMLNode named CustomerAddress1Node. If CustomerAddress1Node maps to a schema element that has an integer data type, then the validation will fail.

Private Sub ValidateNode()
    Me.CustomerAddress1Node.NodeText = "Nineteen Hundred" 
    Me.CustomerAddress1Node.Validate()

    If Me.CustomerAddress1Node.ValidationStatus = _
        Word.WdXMLValidationStatus.wdXMLValidationStatusOK Then
        MsgBox("'" & Me.CustomerAddress1Node.BaseName & "' validates.")
    Else
        MsgBox("'" & Me.CustomerAddress1Node.BaseName & _
            "': " & Me.CustomerAddress1Node.ValidationErrorText(False))
    End If 
End Sub
private void ValidateNode()
{
    this.CustomerAddress1Node.NodeText = "Nineteen Hundred";
    this.CustomerAddress1Node.Validate();

    if (this.CustomerAddress1Node.ValidationStatus ==
        Word.WdXMLValidationStatus.wdXMLValidationStatusOK)
    {
        MessageBox.Show("'" + this.CustomerAddress1Node.BaseName +
            "' validates.");
    }
    else
    {
        MessageBox.Show("'" + this.CustomerAddress1Node.BaseName +
            "': " + this.CustomerAddress1Node.ValidationErrorText[false]);
    }
}

.NET Framework Security

See Also

Reference

XMLNode Class

XMLNode Members

Microsoft.Office.Tools.Word Namespace