示例#1
0
        private void EmailBox_Leave(object sender, EventArgs e)
        {
            EmailBox.Text = EmailBox.Text.TrimEnd(' ');

            if ((EmailBox.Text == "") || (!Regex.IsMatch(EmailBox.Text, "[a-z0-9!#$%&'*+/?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?")))
            {
                EmailWarningLabel.ForeColor = Color.Red;
            }
            EmailBox.Select(0, 0);
        }
示例#2
0
 /// <summary>
 /// Will auto fill the username and password if the person has already filled it out before clicking register
 /// </summary>
 public void AutoFill(string username, string password)
 {
     UsernameBox.Text = username;
     PasswordBox.Text = password;
     //Lets activate the correct box control
     if (string.IsNullOrEmpty(username))
     {
         UsernameBox.Select();
     }
     else if (string.IsNullOrEmpty(password))
     {
         PasswordBox.Select();
     }
     else
     {
         EmailBox.Select();
     }
 }