Key Handling, Alt+Down Arrow

  • Thread starter Thread starter jason
  • Start date Start date
J

jason

hi,

I need to trap combination keys Alt+DownArrow in KeyDown events, but without
any success. Here is the code :

private void myTextBox_KeyDown(object sender, KeyEventArgs e)

{

if(e.KeyCode == Keys.Down && e.Alt)

{

MessageBox.Show("Pressed");

}

}



Thanks.
 
Hi Jason,

Your code should work. Could you provide us with a small but complete
sample of your code?
 
jason said:
I need to trap combination keys Alt+DownArrow in
KeyDown events, but without any success. Here is the code :

private void myTextBox_KeyDown(object sender, KeyEventArgs e)

{

if(e.KeyCode == Keys.Down && e.Alt)

Try this:

\\\
if ((e.KeyCode == Keys.Down) && ((Control.ModifierKeys & Keys.Alt) ==
Keys.Alt))
...;
///
 
The code works only if textbox's parent is a form.

It does not work if textbox is a child control of DataGridColumnStyle.


Thanks.
 
Back
Top