[RESOLVED] [2005] How To Detect In KeyPress Ctrl+Enter?
Hello, I just downloaded C# 2005 Express last night to try it out and I liked it, so I started a project with it. I just have a quick question. How would I, in the KeyPress event of a textbox see if the use pressed the Enter key as they were holding Ctrl, like in Internet Explorer you can type google, then hold Ctrl and press Enter it will change it to http://www.google.com/ and navigate to it. That is what I want to do with my web browser project. I just don't know how to detect if ctr is being held down in the textbox.
Thanks
Re: [2005] How To Detect In KeyPress Ctrl+Enter?
Nevermind, I figured it out. I guess you can't do it in KeyPress, but in KeyDown you can use modifiers.
Thanks
Re: [2005] How To Detect In KeyPress Ctrl+Enter?
It's important to understand the difference between the purposes of the KeyDown and KeyUp events compared to the KeyPress event.
The KeyDown and KeyUp events correspond to keys on the keyboard being depressed and released, while the KeyPress event corresponds to a character being entered in a control. For example, if you press the C key on the keyboard you'll get a KeyDown event for the Keys.C key, a KeyPress event for the "c" character (lower case), then a KeyUp event for the Keys.C key. In contrast if you press the Shift+C key combination you'll get one KeyDown event for Keys.Shift and one KeyDown event for Keys.C, followed by on KeyPress event for "C" (upper case), followed by one KeyUp event for Keys.Shift and one KeyUp event for Keys.C.