02-07-19, 04:14 PM
كود :
private void TxtEmail_KeyUp(object sender, KeyEventArgs e)
{
System.Text.RegularExpressions.Regex rEmail = new System.Text.RegularExpressions.Regex(@"^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$");
if (TxtEmail.Text.Length > 0 && TxtEmail.Text.Trim().Length != 0)
{
if (!rEmail.IsMatch(TxtEmail.Text.Trim()))
{
TxtEmail.BackColor = Color.Red;
}
else
{
TxtEmail.BackColor = Color.YellowGreen;
}
}
}انا مجرب الكود ده
غير الجملة الشرطية زى ما تحب
