Nate879

I am trying to get the program to respond to keys being typed on the keyboard. My.computer.keyboard only has a few to choose from, and I need to use the others. How do I do that



Re: Visual Basic Express Edition Keyboard Input Help

DMan1

set the forms keypreview property to true and then use the forms keydown or keypress (depending on what you want to trap) events to check for keystrokes




Re: Visual Basic Express Edition Keyboard Input Help

NateNate

How do you use events It should be made simpler.





Re: Visual Basic Express Edition Keyboard Input Help

DMan1

It is very simple Nate...

Go to the forms code view and from the top left hand corner combobox select "Form Events" and then from the top right hand combobox select the "Keypress" event and it will auto insert the proper event signature!...All you have to do is write the code inside of the method...you need to be aware of the different keystrokes that are registered in the keydown/keyup events versus the keypress event...take a look at the msdn help:

http://msdn.microsoft.com/library/default.asp url=/library/en-us/cpref/html/frlrfsystemwindowsformscontrolclasskeydowntopic.asp

http://msdn.microsoft.com/library/default.asp url=/library/en-us/cpref/html/frlrfsystemwindowsformscontrolclasskeypresstopic.asp






Re: Visual Basic Express Edition Keyboard Input Help

NateNate

Thanks! It now works as expected.