ComponentOne True DBInput Pro 8.0
DBError Event (TDBDate)

 

Reference> TDBDate Control> TDBDate Control Events> DBError Event (TDBDate)

DBError Event (TDBDate)

Occurs when the data retrieved from a bound data source is either out of the MaxDate and the MinDate range or an invalid value.

Syntax

control_DBError (ErrorCode As Integer)

Arguments

errorcode is an integer that returns a number identifying the error that has occurred.

The possible values of the errorcodes are as follows:

0

The retrieved value is an invalid value.

1

The retrieved value exceeds the minimum or maximum value set by the MaxDate or MinDate property.

Remarks

This event is fired only when retrieving data from a bound data source to the control. If the current record is an invalid value such as regular text, the errorcode will return a 0. If the current record (Date type field) exceeds the MinDate or the MaxDate, the errorcode argument returns a 1 notifying the user the value is out of the appropriate range. Error code 2 will be returned when the retrieved value is within the maximum and the minimum date but yet not allowed as a selected date type specified by the SelectWhat property.

By default, if the value retrieved from the data source does not fall within the range of the MaxDate and MinDate values, the close date (either the MaxDate or the MinDate date) will be activated (that is, focus rectangle is located and not selected). If a Null or an invalid value is passed in, the current system date will be activated. However, if the current date is out of the limited range, then either the MaxDate or the MinDate date will be applied, just as in the first case.

When modifying date values by changing the Value, Number, or the Text properties that are not within the proper range, or are otherwise invalid, a trappable error will occur. No events are fired in this case.

The TDBDate control allows you to enter any valid date while the control has the focus, including dates that exceed the MaxDate and MinDate properties. There will be no range checking for the entered date. But as soon as the user attempts to move the focus away, the InvalidRange event will be fired, notifying that the entered date was out of range.

The TDBNumber control allows you to enter any numeric values that are generally within the number of digits specified in the Format property, both positive and negative, regardless of the MaxValue and MinValue properties. There will be no range checking for the entered value until you move the focus away. As soon as the control loses the focus, the InvalidRange event will be invoked notifying the user that the entered value was out of range.

The TDBTime control allows you to enter any valid time while the control has the focus, including times that exceed the MaxTime and MinTime properties. There will be no range checking for the entered time. But as soon as the user attempts to move the focus away, the InvalidRange event will be fired notifying that the entered time was out of range.

When the DBError event occurs, the old data will be displayed in the control until valid data is retrieved. To modify the value, please handle the error process correctly in this event.

When modifying text values by changing the Value or the Text properties to an invalid value that does not match the input mask, you will cause a trappable error to occur without any events firing.

Notes           

Databinding is not supported in multiple selection mode. You must set the MultiSelect to 0-None in order for the bound datasource to work properly.

If a floating-point value is read from a data source and it contains more decimal digits than can be displayed, the control will maintain the precise value. However, only the number of digits specified with the input mask will be displayed in the control. If the integral digits exceed the specified number of digits, the value will be handled as an invalid value, returning an error code - 0.

The controls fully support ADO, RDO, and DAO.

See Also

MaxDate Property (TDBDate)

MinDate Property (TDBDate)

SelectWhat Property (TDBCalendar)

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback