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

key events in a winforms custom control class

P: 1
I've been building my own nullable and bindable datetimepicker class, which inherits from DateTimePicker and includes a textbox to handle any user text entry, blanking the date for null, and such. Works great and handles all my needs just fine, except for one thing: key events when the calendar is dropped down. I wanted to capture the Enter key (which would set the control value to the dtp value; and the Escape key (which would leave the control value unchanged). I'm doing all the synchronization work between Mybase.Value and the control's value at the CloseUp event and figured it would be no sweat to intercept the key events and set some flags to whatever I wanted. But no go. I've tried 'em all, from PreviewKeyDown to ProcessCmdKey and everything in between, and I never get one before Closeup. I'm sure I'm missing something simple, but have no idea what.
Dec 12 '14 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.