Board index » delphi » TDBEdit - Dates and Edit Mask

TDBEdit - Dates and Edit Mask

I am having a minor problem with the EditMask for a TField when using a
TDBEdit. I am using D3.01.

When a user types in a date, deletes it, and then attempts to leave the
TDBEdit, the following error is generated:

'  /  /    ' is not a valid date.

Is there an easy fix??

I am using the following editmask:

!99/99/9999;1;_

TIA,
Rea

 

Re:TDBEdit - Dates and Edit Mask


Rea,

Look at the DBVldEdit Component, this object is an alternative for the
DBEdit object.
enhanced capailities are

Validating data Before leaving the field
Maintaining Focus and Caret after showing messages
Instant trapping of Required fields
Suspending validation on special events
Filling of default values on creating new records
MaskEdit capabilities
Alert beep controlable

Description:

Added is an OnValidate event to check data before leaving the field.
In this event you can check the value of the field (  /  /  ) and invoke
the clear method to empty it.
( the OnExit event is executed after leaving the field). It leaves the
focus on the DBVldEdit field.
Tabbing trough other fields (or controls) or clicking another object
invokes the event to
happen.
To insure that the validation can be overridden, a property CtlNames is
created which is a
list of controls that can be set that do not invoke the OnValidate
event.(for instance an Find
Button to lookup some value in a second form)

When adding a new record defaults can be filled out from the component
itself. It has a
property that can be filled out for this purpose.

The EditMask propertyis added so data can be formatted when entered. It
works as the
normal EditMask property on an MaskEdit component.

Beeping can be toggled on the validation When the message you generate
beeps also it can
get annoying for the End User.

It can be found at: Http://www.skzl.nl/~jvdvelde

Kind regards, Sjef van der Velde

Quote
Rea Berryman wrote:
> I am having a minor problem with the EditMask for a TField when using a
> TDBEdit. I am using D3.01.

> When a user types in a date, deletes it, and then attempts to leave the
> TDBEdit, the following error is generated:

> '  /  /    ' is not a valid date.

> Is there an easy fix??

> I am using the following editmask:

> !99/99/9999;1;_

> TIA,
> Rea

Re:TDBEdit - Dates and Edit Mask


I would suggest using a data aware DateEdit component. Like the one that
comes with RxLib. Go to : http://rx.demo.ru/
--

Alain Quesnel

If you reply by e-mail, remove the brackets on
each side of my reply-to address.

Rea Berryman <rberry...@earthlink.net> wrote in article
<34679B26.1...@earthlink.net>...

Quote
> I am having a minor problem with the EditMask for a TField when using a
> TDBEdit. I am using D3.01.

> When a user types in a date, deletes it, and then attempts to leave the
> TDBEdit, the following error is generated:

> '  /  /    ' is not a valid date.

> Is there an easy fix??

> I am using the following editmask:

> !99/99/9999;1;_

> TIA,
> Rea

Other Threads