FormErrorCollection.Delete Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
Delete(FormError) |
Deletes the specified FormError from the FormErrorCollection object associated with the current form. |
Delete(String) |
Deletes all FormError objects of the specified name from the FormErrorCollection object associated with the current form. |
Delete(FormError)
Deletes the specified FormError from the FormErrorCollection object associated with the current form.
public:
abstract void Delete(Microsoft::Office::InfoPath::FormError ^ formError);
public abstract void Delete (Microsoft.Office.InfoPath.FormError formError);
abstract member Delete : Microsoft.Office.InfoPath.FormError -> unit
Parameters
- formError
- FormError
The FormError to delete.
Exceptions
The parameter passed to this method is not valid. For example, it is of the wrong type or format.
The parameter passed to this method is a null reference (Nothing in Visual Basic).
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))
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.
Applies to
Delete(String)
Deletes all FormError objects of the specified name from the FormErrorCollection object associated with the current form.
public:
abstract void Delete(System::String ^ name);
public abstract void Delete (string name);
abstract member Delete : string -> unit
Public MustOverride Sub Delete (name As String)
Parameters
- name
- String
The name of the FormError to delete.
Exceptions
The parameter passed to this method is not valid. For example, it is of the wrong type or format.
The parameter passed to this method is a null reference (Nothing in Visual Basic).
Examples
In the following example, the Delete(name
) method is used to delete the error name Field1Error from the FormErrorCollection object associated with the current form.
this.Errors.Delete("Field1Error");
Me.Errors.Delete("Field1Error")
Remarks
All errors of the specified name will be deleted from the collection (errors associated with different context nodes in the form can have the same name). 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 only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.
This type or member can be accessed from code running in forms opened in Microsoft InfoPath Filler or in a Web browser.