private void txtEmpCode_TextChanged_1(object sender, EventArgs e)
{
if (System.Text.RegularExpressions.Regex.IsMatch(txtEmpCode.Text, "[^0-9]"))
{
MessageBox.Show("Please enter only numbers.");
txtEmpCode.Text.Remove(txtEmpCode.Text.Length - 1);
txtEmpCode.Text = "";
}
}
{
if (System.Text.RegularExpressions.Regex.IsMatch(txtEmpCode.Text, "[^0-9]"))
{
MessageBox.Show("Please enter only numbers.");
txtEmpCode.Text.Remove(txtEmpCode.Text.Length - 1);
txtEmpCode.Text = "";
}
}
No comments:
Post a Comment