Board index » delphi » Blanking masked date fields and date-masked TEdits!
ABO (Alberto Braggiotti)
![]() Delphi Developer |
Sat, 30 May 1998 03:00:00 GMT
Blanking masked date fields and date-masked TEdits!
I use in a table 2 date fields for the starting and ending dates of a
time period. Occasionally one of these fields need to be blanked (for instance when the period is still continuing and only the starting date is needed or when I want to make calculations until a certain date). I need also to mask the field and to store the separators (a slash / in this case), otherwise I get these ugly double-slashed date-like messages when I hit backspace over the selected field. The mask I use is '99/99/00;1;_'. When I select the field and I hit BS, I get an error message: '00/00/00 is not a valid date' during the execution of the instruction Table1.Edit; ---> Table1.FieldByName('STARTDATE').AsString := DateToStr(s): Table1.Post: Tried with s='', s=' / / '. OK, I solved the problem by executing the following code on the OnSetText event: Now the questions: 1 - Is this the simplest way to blank a masked date field or some delphian 2 - How to do the same thing with a TEdit component, with the same date mask? Thank in advance. Alberto Braggiotti |