FormErrorCollection class
Contains a FormError object for each error in the current form.
Namespace: Microsoft.Office.InfoPath
Assembly: Microsoft.Office.InfoPath (in Microsoft.Office.InfoPath.dll)
A FormErrorCollection object contains a collection of FormError objects that represent all errors occurring in the associated form. The collection of errors includes validation errors, system-generated errors, and user-defined (custom) errors. The FormErrorCollection class provides properties and methods for adding, deleting, and gaining access to the FormError objects that it contains. You cannot delete validation or system-generated errors from this collection.
In addition to managing the errors generated by InfoPath, the FormErrorCollection class can also be used to create custom errors using the Add method.
Note |
|---|
Custom errors can also be created using the ReportError method of the XmlValidatingEventArgs class. |
To access the FormErrorCollection object associated with a form, use the Errors property of the XmlForm class.
In the following example, first an XPathNavigator object is positioned at the field with which to associate an error. Then, the XPathNavigator and error message details are passed to the Add method of the FormErrorCollection class to add the error to the form's error collection.
Note