well i am using masktextbox control for phone entry .i have problem that when user press the enter key witout filling data in masked textbox then it accept change and coursor go to next control ...but when user enter the data then data must be 10 character....i have done this but it didn't work when user insert less than specified range and press enter then it go to next control...i dont wnat this ...if user entering the data user have to input data to that specified range ...i am pasting code kindly suggest me.
CODE
private void maskedTextBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if ((int)e.KeyChar == 13)
{
if (maskedTextBox1.Text == "")
{
textBox2.Focus();
}
else if ((maskedTextBox1.TextLength > 10) || (maskedTextBox1.TextLength < 10))
{
MessageBox.Show("Data must be 5 character");
maskedTextBox1.Focus();
}
else
{
textBox2.Focus();
}
}