Show "empty" TDateTimePicker

Larry Lustig picture Larry Lustig · Nov 20, 2010 · Viewed 12.7k times · Source

How can I show an "empty" TDateTimePicker in Delphi 2010 (that is, hide the display of the date so the control appears empty). I know about the trick of setting the format to show the epoch, but with Delphi 2010 running on Windows 7 the string "A.D." appears in the control when I do this.

Answer

RRUZ picture RRUZ · Nov 20, 2010

try setting the format to a blank space Value.

DateTimePicker1.Format:=' ';

and then in the OnChange method set the format again

procedure TForm1.DateTimePicker1Change(Sender: TObject);
begin
DateTimePicker1.Format:=ShortDateFormat;
end;