View Single Post
 
Old 06-28-2012, 02:01 PM
OldTurtle OldTurtle is offline
Junior Member
 
Join Date: Apr 2010
Posts: 18
Default

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.