on TextBox KeyPress event write this code :
private void txy_Keypress(object sender, KeyPressEventArgs e)
{
if (!char.IsNumber(e.KeyChar) & (Keys)e.KeyChar != Keys.Back & (Keys)e.KeyChar != Keys.Enter)
{
e.Handled = true;
}
base.OnKeyPress(e);
}
and on TextChanged event write this code :
if (txtMob.Text.Length > 10)
{
MessageBox.Show("Invalid Mobile Number !!");
txtMob.Focus();
}
or set text Maxlenth proparty set 10
hope this help