ERRORS Collection


The Errors collection contains a set of error objects for each error that occurred in the current form. Each of the Error objects contains specific information about the error that occurred and is accessed as shown in Table A.11.

Table A.11: Properties and Methods of The Errors Collection.

Name

Security Level

Description

Count Property

1

Is a read-only property that contains the total number of Error objects contained in the Errors collection.

Item Property

1

Is a read-only property that returns a reference to the specific error referenced in the index number.

Add Method

2

Adds an error to the Error object and returns a reference to the new Error object.

Delete Method

2

Deletes errors that were created using the Add method for a specific XML node and that have the same name. It cannot delete all errors because of the enforced schema validation of errors that were reported using ReportError method of the DataDOMEvent object.

DeleteAll Method

2

Deletes all errors in the Errors collection regardless of how they were created.

Note  

The ADD method is used to create custom error messages. The following two types of errors can be created:

Modal: The user is notified of the error with an alert. After clicking on OK, the user can return to the previous value through an automatic undo operation.

Modeless: The user is notified of the error with an inline alert and can choose to return to the previous value with an undo operation.

The following example adds a custom error message to the current Errors collection:

 var objErrors; var objError; objErrors = XDocument.Errors; objError = objErrors.Add(anXMLNode, "A Validation Error has occurred",  "Specified data is invalid"); 



Programming Microsoft Infopath. A Developers Guide
Programming Microsoft Infopath: A Developers Guide
ISBN: 1584504536
EAN: 2147483647
Year: 2006
Pages: 111
Authors: Thom Robbins

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net