-
Capture Shift+Tab
I have multiple text boxes that based on conditions the user is directed to different controls on the form. I need to be able to capture the shift+tab in order to determine which textbox they previously came from. Does anyone have any code or can point me in the right direction to do this?
Any and all help as always is greatly appreciated.
Thanks,
Tomson
-
You need to handle the keydown event. If you need to capture at the form level, set the KeyPreview property to true. This code snippet is in C#, but it shouldn't be to hard to decipher. Let me know if you need translation.
Code:
private void Form1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) {
if (e.Shift && e.KeyCode == Keys.Tab) {
MessageBox.Show("Shift & Tab Pressed!");
}
}
-
Thanks a ton. I will try it. I worked in C++ but it has been many many many years ago. I will let you know if I need any additional help. If not, thanks again.
Tomson.
-
Okay, tried it but couldn't get it to work. It acts as if it is only capturing the shift key and not the tab key at the same time.
Translation would be appreciated.
Thanks,
Tomson