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

Clearing the RadDateTimePicker with the Backspace key

1 Answer 320 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 12 Jun 2013, 04:32 PM
I have added this code to the KeyDown event for the datetimepicker and the Delete key clears the value as expected, but the Backspace key just sets the date back six months. Is there something I'm missing:

if (e.KeyData == Keys.Delete || e.KeyData == Keys.Back)
{
    fromField.SetToNullValue();
    e.Handled = true;
}

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 17 Jun 2013, 10:29 AM
Hi Paul,

Thank you for writing.

It seems that the Handled flag is not taken into consideration in this case. I have logged it in our Public Issue Tracking System and you can add your vote for this issue here: http://www.telerik.com/support/pits.aspx#/public/winforms/15191.

To work around the issue you can use the KeyUp event of the control:
void radDateTimePicker1_KeyUp(object sender, KeyEventArgs e)
{
    if (e.KeyData == Keys.Delete || e.KeyData == Keys.Back)
    {
        radDateTimePicker1.SetToNullValue();
    }
}

Your Telerik Points have been updated for this report.

Should you have any other questions or suggestions, do not hesitate to contact us.
 

Regards,
Stefan
Telerik
RadChart for WinForms is obsolete. Now what?
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Paul
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or