Hi Gene,
you can derive your own textbox class from the
System.Windows.Forms.TextBox and then override the ProcessCmdKey method to
not allow the user to tab away from the control
For example:
class MyTextBox : TextBox
{
public MyTextBox() : base()
{
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if(keyData == Keys.Tab)
{
//do
nothing, so return true;
return true;
}
return base.ProcessCmdKey (ref msg, keyData);
}
}
Hope that helps
Mark R Dawson
"Gene Vital" wrote:
C#
I am trying to figure out how to disable the Tab key in a TextBox.I need
to prevent the user from leaving the TextBox unless the data was entered
correctly, any pointers?