Clearing the RadDateTimePicker with the Backspace key

2 posts, 0 answers
  1. Paul
    Paul avatar
    23 posts
    Member since:
    Feb 2013

    Posted 12 Jun 2013 Link to this post

    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;
    }
  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 17 Jun 2013 Link to this post

    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?
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top