DateTimePicker - Disable user from using arrow keys?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Artie

    DateTimePicker - Disable user from using arrow keys?

    Hi,

    I want to force the user to only use the drop down and calendar to
    select a date in the DatetimePicker control.

    I do NOT want them to select the control, then use the up and down
    arrow keys to change the date.

    How can I prevent them using the arrow keys?

    Any help much appreciated.

    Cheers

    Artie
  • Franck

    #2
    Re: DateTimePicker - Disable user from using arrow keys?

    private void dateTimePicker1 _KeyDown(object sender,
    System.Windows. Forms.KeyEventA rgs e)
    {

    if (e.KeyCode.ToSt ring() == "Down" || e.KeyCode.ToStr ing() == "Up")
    {
    e.Cancel;
    }

    }


    Comment

    • Claes Bergefall

      #3
      Re: DateTimePicker - Disable user from using arrow keys?


      "Alcides" <alcides_schulz @hotmail.comwro te in message
      news:d6f7cf82-2f13-462a-a03a-b5248600af8c@h2 5g2000hsf.googl egroups.com...
      <snip>
      if (e.KeyCode.ToSt ring() == "Down" || e.KeyCode.ToStr ing() ==
      "Up")
      if (e.KeyCode == Keys.Down || e.KeyCode == Keys.Up)

      /claes


      Comment

      Working...