Jump to content
Squall_FF8

Is there a way to Clear content of TDateTimePicker?

Recommended Posts

Hi guys,

I use TDateTimePicker, but I cant find a method to "nullify" it. The value will be passed to SQL query, so I would like to be able to pass Null.

P.S. I have 2 pickers, one for date and one for time. They both should be able to pass "no value" (null).

Share this post


Link to post

See if it has an option like "Enable null". I don't work with that. So I don't know.

Share this post


Link to post
1 hour ago, Squall_FF8 said:

Hi guys,

I use TDateTimePicker, but I cant find a method to "nullify" it. The value will be passed to SQL query, so I would like to be able to pass Null.

P.S. I have 2 pickers, one for date and one for time. They both should be able to pass "no value" (null).

The control has a ShowCheckbox property. This gives the user a checkbox to check or uncheck to indicate a NULL or NOT NULL state. The Checked property then tells you the user's descision. A bit cumbersome but the Windows common control behind TDatetimepicker has no concept of an "empty" state.

Share this post


Link to post
14 minutes ago, PeterBelow said:

The control has a ShowCheckbox property. This gives the user a checkbox to check or uncheck to indicate a NULL or NOT NULL state. The Checked property then tells you the user's descision. A bit cumbersome but the Windows common control behind TDatetimepicker has no concept of an "empty" state.

Thank you very much! Great idea!

It seems that the check plays the role of Enabled: On/OFF, so disabled (grayed text) is visually good enough hint for: no value.

It is strange that VCL lacks that option. FMX has IsEmpty on its pickers. Usually FMX lacks things that VCL has  🙂

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×