Tim said:
You could do something similar to the following.
private void textBox1_TextChanged(object sender, System.EventArgs e)
{
if (this.textBox1.TextLength == this.textBox1.MaxLength)
{
this.SelectNextControl(this.textBox1, true, true, true, true);
}
}
I'd do it on KeyUp, because I believe TextChanged doesn't fire until the
control loses focus (i might be thinking of javascript though).
private void textBox1_KeyUp(object sender, KeyEventArgs e) {
if (textBox1.TextLength == textBox1.MaxLength) {
textBox2.Focus();
}
}
actually I just tried it and textchanged does work after every keypress.
So either TextChanged or KeyUp will work for you.