This is a migrated thread and some comments may be shown as answers.

TimePicker - Null Value

1 Answer 456 Views
TimePicker
This is a migrated thread and some comments may be shown as answers.
Doug
Top achievements
Rank 1
Doug asked on 24 Sep 2013, 05:29 PM
I'm storing a DateTime in XML to tell an applicaton when it will shut down.  I intend to use the value of "01/01/0001 00:00:00" to mean that we have no shut down scheduled.  On the form that will get and set this value I am using two controls, a DateTimePicker and a TimePicker, to work with the value.  (I'm open to other options.)

You already taught me how to handle the DateTimePicker so I'm initializing that control like this:
dtpShutDown.NullDate = Convert.ToDateTime("01/01/0001");
dtpShutDown.NullText = "";
dtpShutDown.Value = Convert.ToDateTime("01/01/0001");

I'm not quite there with the equivalent for the time picker.  This gives me the "00:00 AM" text:
tpLogin.NullText = "";
tpLogin.Value = Convert.ToDateTime("01/01/0001 00:00:00");

I would like some way to just blank out the whole value.

I'm working with options while I wait for your response.  A single DateTimePicker with a custom format to include the time may work out better than I had initially thought.  (Regardless, I would like to know how to set the null time for the TimePicker.)

Thank you,
Gary


1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 27 Sep 2013, 02:28 PM
Hello Gary,

Thank you for contacting Telerik Support.

RadTimePicker.Value's type is DateTime? and allows null as value. Thus, you can obtain an empty RadTimePicker:
radTimePicker1.NullText = string.Empty;
radTimePicker1.Value = null;

I hope this information helps. Should you have further questions, I would be glad to help.

Regards,
Desislava
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
TimePicker
Asked by
Doug
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or