[RESOLVED] noob stupid easy thing.......AGRH not enough coffee
OK im sure ill get flamed for beig a noob but i have spent a hour searching for how to do this and im still not getting it...... if someone could explaine how to link a keystroke to an event? like if someone presses the key 1 the my.computer.audio.play (openfiledialog1.Filename) would play,
excuse the bad english its late here :o
Re: noob stupid easy thing.......AGRH not enough coffee
Set the KeyPreview property of the form to True and then test for the desired key in an event handler for the form. The KeyPress event would be the preference, but if it is one of the less common keys that is not detected in the KeyPress event then you can use the KeyDown or KeyUp event instead.
By the way, I won't flame you for being a noob, but I do have a preference for descriptive thread titles. :)
Re: noob stupid easy thing.......AGRH not enough coffee
Would this only Work if the Form is in Focus? What if its Minimized? If it Wont Detect whats the Search Item for that Feature?
Re: noob stupid easy thing.......AGRH not enough coffee
Quote:
Originally Posted by Codehammer
Would this only Work if the Form is in Focus? What if its Minimized? If it Wont Detect whats the Search Item for that Feature?
Yes this will only work if the form has focus. If you want to detect keystrokes at other times too, take a look at this article by one of our fellow VBF members.
Re: noob stupid easy thing.......AGRH not enough coffee
i love you
j/k thanks a whole heap
p.s if i ever run out of coffee watch for my discriptive title thingys
Re: [RESOLVED] noob stupid easy thing.......AGRH not enough coffee
Here's another article of interest.
Re: [RESOLVED] noob stupid easy thing.......AGRH not enough coffee