I built 3 textbox classes. The auto tab does not tab to the next control in
the tab list. No errors, and the code steps through
"this.SelectNextControl(this, true, true, true, true);".
What is the code missing, so the auto tab will go to the next control in the
tab list when the max length value is reached?
class ClassTextBox : System.Windows.Forms.TextBox
{
protected override void OnEnter(System.EventArgs e)
{
base.OnEnter(e);
SelectAll();
}
}
class ClassTextBoxNum : ClassTextBox
{
protected override void OnKeyPress(KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) &&
!Char.IsControl(e.KeyChar))
{
e.Handled = true;
}
base.OnKeyPress(e);
}
}
class ClassTextBoxNumTab : ClassTextBox
{
protected override void OnKeyPress(KeyPressEventArgs e)
{
if (!Char.IsDigit(e.KeyChar) && !Char.IsControl(e.KeyChar))
{
e.Handled = true;
}
base.OnKeyPress(e);
}
protected override void OnTextChanged(EventArgs e)
{
base.OnTextChanged(e);
if (this.Text.Length == this.MaxLength)
{
this.SelectNextControl(this, true, true, true, true);
}
}
}