Board index » delphi » How to clear TDBEdit with mask?

How to clear TDBEdit with mask?

How do you clear a TDBEdit control which is bound to a field with a mask?

For example, I have a TDBEdit bound to a date field in a database. The
TDateTimeField the control is bound to has the following EditMask property:
!00/00/0000;1;_ The problem is that once you enter a date, you can not clear
it out. When the user attempts to leave the control, some event is firing
which brings up "  /  /   is not a valid date." and the user is forced to
put in a date.

Any help?

 

Re:How to clear TDBEdit with mask?


Quote
In article <6caka1$o...@forums.borland.com>, Tarek Kamil wrote:
> How do you clear a TDBEdit control which is bound to a field with a mask?

Issue the Clear method on its underlying TField.

 Mike Orriss (m...@compuserve.com)
 http://ourworld.compuserve.com/homepages/mjo

Re:How to clear TDBEdit with mask?


Mike,

I believe that it is the mask which is raising the error message ("'  /  /
' is not a valid date/time.").  This event seems to occur before any events
on the field occur, e.g. OnSetText, OnValidate, OnChange, etc.

Quote
Mike Orriss wrote in message ...
>In article <6caka1$o...@forums.borland.com>, Tarek Kamil wrote:
>> How do you clear a TDBEdit control which is bound to a field with a mask?

>Issue the Clear method on its underlying TField.

> Mike Orriss (m...@compuserve.com)
> http://ourworld.compuserve.com/homepages/mjo

Other Threads