KeyDown problem
-
I have a form (name MyForm), where I want to know when the Arrow keys pressed so I made this function but its not working for the arrow keys. Its working great for all the others (shift, alt, caplock.....) dont know what to do please help in the constructor: this->add_KeyDown(new KeyEventHandler(this, &MyForm::KeyDown)); the function: void MyForm::KeyDown(Object *sender, KeyEventArgs *e) { switch(e->KeyCode) { case Keys::Down: MessageBox::Show("Key Down was pressed"); s->Down(picGame->Handle); } } I tried to step with the debugger, nothing happens when I press arrow keys Its not getting in to the function for all other keys it does.:confused:
-
I have a form (name MyForm), where I want to know when the Arrow keys pressed so I made this function but its not working for the arrow keys. Its working great for all the others (shift, alt, caplock.....) dont know what to do please help in the constructor: this->add_KeyDown(new KeyEventHandler(this, &MyForm::KeyDown)); the function: void MyForm::KeyDown(Object *sender, KeyEventArgs *e) { switch(e->KeyCode) { case Keys::Down: MessageBox::Show("Key Down was pressed"); s->Down(picGame->Handle); } } I tried to step with the debugger, nothing happens when I press arrow keys Its not getting in to the function for all other keys it does.:confused:
-
Youre right. I tried it with an empty form and it worked. I have on my form only a picturebox and a button, how can I keep the forms focus always. I never need the focus on the other controls. thanks.
-
hai, Sorry i dont know how it solve!!! Some where i found to override the ProcessmdKey method but i didn't get too much ideas If u solve the problem plz post it by ANish