By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,846 Members | 2,094 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,846 IT Pros & Developers. It's quick & easy.

DateTimePicker - Disable user from using arrow keys?

P: n/a
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
Feb 21 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
private void dateTimePicker1_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e)
{

if (e.KeyCode.ToString() == "Down" || e.KeyCode.ToString() == "Up")
{
e.Cancel;
}

}
Feb 21 '08 #2

P: n/a

"Alcides" <al************@hotmail.comwrote in message
news:d6**********************************@h25g2000 hsf.googlegroups.com...
<snip>
if (e.KeyCode.ToString() == "Down" || e.KeyCode.ToString() ==
"Up")
if (e.KeyCode == Keys.Down || e.KeyCode == Keys.Up)

/claes
Feb 22 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.