Hi all,
I want to detect when the user press tab in a textbox, instead of moving to the next control
I also want to be able to know when the user press tab and when the computer sendkeys tab
Printable View
Hi all,
I want to detect when the user press tab in a textbox, instead of moving to the next control
I also want to be able to know when the user press tab and when the computer sendkeys tab
AFAIK, there is no real way to tell if the textbox is receiving a physical tab keypress or is receiving a sendkeys tab keypress.
Why do you need to know the difference?
You would need to inherit the TextBox class and override the ProcessCmdKey method to filter out the Tab key:As far as the control is concerned there is no difference. It gets the same message from Windows either way.vb.net Code:
Public Class TextBoxEx Inherits TextBox Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, _ ByVal keyData As System.Windows.Forms.Keys) As Boolean Return (keyData And Keys.Tab) = Keys.Tab OrElse _ MyBase.ProcessCmdKey(msg, keyData) End Function End Class