Vali dati onErr or

The ValidationError event enables you to take action when a validation error within an XMLNode occurs. A validation error can occur if the data entered into the XMLNode does not conform to the XML schema.

For example, if the schema requires a number and you enter a string, the ValidationError event is raised. Listing 6.34 displays the validation error text in a message box when ValidationError is raised on an XMLNode control named NameFirstNameNode.

Listing 6.34. Displaying a message box when a validation error occurs within an XMLNode control

Private Sub NameFirstNameNode_ValidationError(ByVal sender _ As Object, ByVal e As System.EventArgs) Handles _ NameFirstNameNode.ValidationError

Dim invalidXML As Microsoft.Office.Tools.Word.XMLNode _ = CType(sender, Microsoft.Office.Tools.Word.XMLNode)


End Sub

For an example of how you can use the events of XMLNode controls to display and hide controls on the actions pane, see Chapter 5.

0 0

Post a comment