key input
-
i am working on a program for school and it requires key input so when i press the "a" key a block of code will execute i would i do this i am using visual C# 2005 express edition i think it is something like Key_Down but i couldnt get it to work thanks is there somethat will run as long as the key is held down? thanks mike
-
i am working on a program for school and it requires key input so when i press the "a" key a block of code will execute i would i do this i am using visual C# 2005 express edition i think it is something like Key_Down but i couldnt get it to work thanks is there somethat will run as long as the key is held down? thanks mike
xxmikexx wrote:
i think it is something like Key_Down but i couldnt get it to work
You handled the KeyDown event of which control or form?? If it's the form, did you also set the form's KeyPreview property to true?
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
xxmikexx wrote:
i think it is something like Key_Down but i couldnt get it to work
You handled the KeyDown event of which control or form?? If it's the form, did you also set the form's KeyPreview property to true?
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008ya i am working on something so while the "d" key is held down something will happen how would i do this i tried putting it in a button with a tutorial i found but it didnt seem to work it was something like
private void cmdright_KeyDown(object sender, EventArgs e CHANGED SOMETHING HERE)
-
ya i am working on something so while the "d" key is held down something will happen how would i do this i tried putting it in a button with a tutorial i found but it didnt seem to work it was something like
private void cmdright_KeyDown(object sender, EventArgs e CHANGED SOMETHING HERE)
The problem is that you used a button, which doesn't have the input focus for very long. Handle the KeyDown event of the Form.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008