I am not understanding why you would need to set the KeyCode to something
else, if all you want to do is open the DateTimePicker.
If you absolutely need to pass down to base, you can create an EventArg
KeyPressEventAr gs ea = new KeyPressEventAr gs(KeyChar.F4)
base.OnKeyPress (ea);
But, I would think you can pop the control without intercepting the
keystroke.
--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA
Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss
or just read it:
http://gregorybeamer.spaces.live.com/
*************** *************** **************
| Think outside the box! |
*************** *************** **************
"Andrus" <ko********@hot .eewrote in message
news:uR******** ******@TK2MSFTN GP03.phx.gbl...
>I need that WinForms DateTimePicker opens calendar when F12 key is pressed.
I tried code below but got error
Property or indexer 'System.Windows .Forms.KeyEvent Args.KeyCode' cannot be
assigned to -- it is read only
How to fix ?
Andrus.
public class NullableDateTim ePicker : DateTimePicker {
protected override void OnKeyDown(KeyEv entArgs e) {
base.OnKeyDown( e);
if (e.KeyCode == Keys.F12)
e.KeyCode = Keys.F4;
}
}