Some quote from the MSDN[^] site: "The KeyPress event is not raised by noncharacter keys; however, the noncharacter keys do raise the KeyDown and KeyUp events." You should do Keydown's instead of ProcessCmdKey, that's what you are doing anyways...
bradsnobar wrote:
switch (msg.Msg) { case WM_KEYDOWN:
Just do it on the .NET way.
bradsnobar wrote:
switch (keyData) { case Keys.Down:
You could write your switch statement on OnKeyDown method: private void _yourcontrol__KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { switch(e.KeyCode) { case Key.Down: //Do something ... } ... } Beside, embedding System const's in your code is not a nice thing to do. Microsoft could just change the values and your code will go to the outerspace.:laugh: ps.: Some words from MSDN[^]: Notes to Inheritors When overriding the ProcessCmdKey method in a derived class, a control should return true to indicate that it has processed the key. For keys that are not processed by the control, the result of calling the base class's ProcessCmdKey method should be returned. Controls will seldom, if ever, need to override this method. Diego Valdevino