Last active
July 6, 2018 03:47
-
-
Save arman-hpp/8d55c60a29d7a43ef87ab5ea62ed7d71 to your computer and use it in GitHub Desktop.
serialbox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private const int MaxLen = 7; | |
txtSerial1.MaxLength = MaxLen; | |
txtSerial2.MaxLength = MaxLen; | |
txtSerial3.MaxLength = MaxLen; | |
txtSerial4.MaxLength = MaxLen; | |
private void txtSerial1_TextChanged(object sender, EventArgs e) | |
{ | |
if (txtSerial1.TextLength == MaxLen) | |
{ | |
txtSerial2.Focus(); | |
} | |
} | |
private void txtSerial2_TextChanged(object sender, EventArgs e) | |
{ | |
if (txtSerial2.TextLength == MaxLen) | |
{ | |
txtSerial3.Focus(); | |
} | |
} | |
private void txtSerial3_TextChanged(object sender, EventArgs e) | |
{ | |
if (txtSerial3.TextLength == MaxLen) | |
{ | |
txtSerial4.Focus(); | |
} | |
} | |
private void txtSerial4_TextChanged(object sender, EventArgs e) | |
{ | |
if (txtSerial4.TextLength == MaxLen) | |
{ | |
btnSave.Focus(); | |
} | |
} | |
private void txtSerial4_KeyPress(object sender, KeyPressEventArgs e) | |
{ | |
if (txtSerial4.TextLength == 0 && e.KeyChar == (char) Keys.Back) | |
{ | |
txtSerial3.Focus(); | |
} | |
} | |
private void txtSerial3_KeyPress(object sender, KeyPressEventArgs e) | |
{ | |
if (txtSerial3.TextLength == 0 && e.KeyChar == (char)Keys.Back) | |
{ | |
txtSerial2.Focus(); | |
} | |
} | |
private void txtSerial2_KeyPress(object sender, KeyPressEventArgs e) | |
{ | |
if (txtSerial2.TextLength == 0 && e.KeyChar == (char)Keys.Back) | |
{ | |
txtSerial1.Focus(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment