private void PasswordBox_Leave(object sender, EventArgs e) { if ((PasswordBox.Text == "") || (!Regex.IsMatch(PasswordBox.Text, "^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[_\\-@#$%&!<>^*`~?+:,.|])(?!.*[,=;])(?=.{8,})"))) { PasswordWarningLabel.ForeColor = Color.Red; } PasswordBox.Select(0, 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(); } }