Board index » delphi » how to validate a Date field?

how to validate a Date field?

try
  StrToDateTime(Edit1.Text);
except
  ShowMessage('That is not a date, you bozo!');
end;

or something like that

==- siang chuen -== wrote:

Quote

> hi, i got a field of Data/Time type. Now a DBEdit is connected to this
> field.

> Since i can enter any text in the DBEdit, this can really cause
> problem.. how so i validate whether the user has enter a date???

 

Re:how to validate a Date field?


An exception will be raised automatically when the user moves focus off of
the DBEdit or tries to post the record if the value is not a valid date.

--
Bill

Bill Todd (TeamB)
(TeamB cannot respond to questions received via email)

Re:how to validate a Date field?


hi, i got a field of Data/Time type. Now a DBEdit is connected to this
field.

Since i can enter any text in the DBEdit, this can really cause
problem.. how so i validate whether the user has enter a date???

Other Threads