Delphi Programming

  1. Home
  2. Computing & Technology
  3. Delphi Programming

How to make a TDateTimePicker display blank

By Zarko Gajic, About.com

A little trick is to use the letters gg in the format property. This format pattern displays the period or era. This pattern is ignored if the date to be formatted does not have an associated period or era string - which TDateTimePicker does not - thus the display is blank. When a date is subsequently selected you can then set the format to '' in the OnChange or OnClick event handler in order to get it to display again.

The format property was added in Delphi 6. In earler versions add CommCtrl to the uses clause of your unit and use the following code:

~~~~~~~~~~~~~~~~~~~~~~~~~
DateTime_SetFormat(DateTimePicker1.Handle, 'gg') ;
~~~~~~~~~~~~~~~~~~~~~~~~~

Delphi tips navigator:
» How to add a button to the IE Toolbar?
« Change the default directory Delphi uses to save projects

Zarko Gajic
Guide since 1998

Zarko Gajic
Delphi Programming Guide

Explore Delphi Programming

About.com Special Features

Build Your Own Website

Step-by-step advice on how to do everything from choosing a Web host to promoting your content. More >

Connect Your Home Computers

Easy ways to connect two computers for networking purposes. More >

Delphi Programming

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Coding Delphi Applications
  5. Delphi Tips and Tricks
  6. 2002 Delphi Tips
  7. How to make a TDateTimePicker display blank

©2009 About.com, a part of The New York Times Company.

All rights reserved.