CodeCharge Studio

Errors Run-Time Property (ASP)

Applies to

Label Control, TextBox Control, TextArea Control, Checkbox Control, Image Control, ImageLink Control, DatePicker Control, Hidden Control, Connection Control, Grid Form, ListBox Control, CheckboxList Control, RadioButton Control, Record Form, EditableGrid Form, Path Control, Directory Control, FileUpload Control


object (clsErrors)






This property keeps the reference to the object's errors collection. This collection is used to collect error messages generated during the object's execution.

Errors collection exposes three important members:

Member Description
Errors.Count This property returns the number of errors the collection contains. It can be used for testing if the collection is empty or contains any error messages.
Errors.AddError <message> This method adds specified error message to the collection. It can be used to insert error messages when performing custom validation.
Errors.Clear This method resets the collection removing all previously added error messages. It can be used to force successful form submit processing despite validation errors or to clear error messages before replacing them with custom ones.


The following code checks if the errors collection is empty. If there are any error messages, all of them are replaced with a customized one.
The code assumes OrderForm form exists on the page. This code may be inserted into On Validate event.

If OrderForm.Errors.Count > 0 Then
  OrderForm.Errors.AddError "This order cannot be processed. Please fix it."
End If

See also

On Validate event

Related Examples

Using the Control Validation event
Using the Form Validation event
Retrieve Multiple Field Values from a Database

On-line, printable versions and updates