It seems that there are some bugs in TDateTimePicker routines.
A way to bypass this is to avoid the default error checks of component:
In OnChange of FromDate event:
procedure TForm1.FromDateChange(Sender: TObject);
begin
ToDate.Date:= FromDate.Date + 1;
end;
In OnCloseUp event of ToDate:
procedure TForm1.ToDateCloseUp(Sender: TObject);
begin
if DateToStr(ToDate.Date) <= DateToStr(FromDate.Date) then
ShowMessage('wrong date');
end;
This bypass the system error messages. DateToStr is necessary because seems that the component use also the Time part.
Good luck.
|