Compartir a través de


FormErrorCollection.Delete Method (FormError)

Deletes the specified FormError from the FormErrorCollection object associated with the current form.

Namespace:  Microsoft.Office.InfoPath
Assembly:  Microsoft.Office.InfoPath (in Microsoft.Office.InfoPath.dll)

Syntax

'Declaration
Public MustOverride Sub Delete ( _
    formError As FormError _
)
'Usage
Dim instance As FormErrorCollection
Dim formError As FormError

instance.Delete(formError)
public abstract void Delete(
    FormError formError
)

Parameters

Exceptions

Exception Condition
ArgumentException

The error is not of type FormErrorType.UserDefined.

ArgumentException

The error is not in the collection.

ArgumentNullException

The parameter passed to this method is a null reference (Nothing in Visual Basic).

ArgumentException

The parameter passed to this method is not valid. For example, it is of the wrong type or format.

Remarks

Only errors of type ErrorType.UserDefined can be deleted from the collection. If the specified error is not user-defined, or is not in the collection, an exception is thrown.

This member can be accessed without restrictions.

This type or member can be accessed from code running in forms opened in Microsoft InfoPath Filler or in a Web browser.

Examples

In the following example, the GetErrors(FormErrorType) method of the FormErrorCollection class is used to get an array of all user-defined errors in the form's error collection. Then, the Delete(formError) method is used to delete the first FormError object in the array from the form's error collection.

FormErrorCollection myErrors = this.Errors;
FormError[] myUserErrors;

// Get all user defined errors.
myUserErrors = myErrors.GetErrors(FormErrorType.UserDefined);

// Delete the first user defined error.
myErrors.Delete(myUserErrors[0]);
Dim myErrors As FormErrorCollection  = Me.Errors
Dim myUserErrors As FormError()

' Get all user defined errors.
myUserErrors = myErrors.GetErrors(FormErrorType.UserDefined)

' Delete the first user defined error.
myErrors.Delete(myUserErrors(0))

See Also

Reference

FormErrorCollection Class

FormErrorCollection Members

Delete Overload

Microsoft.Office.InfoPath Namespace