/// <summary> /// Occurs whenewer the user amends the passBox /// </summary> private void TextBox_Password_TextChanged(object sender, EventArgs e) { // Checks whether the passBox is empty if (TextBox_Password.Text.Length == 0) { Button_PasswordVisibility.Hide(); Label_Error.Visible = false; } else { Button_PasswordVisibility.Show(); } // Checks whether the passBox is less than 8 characters in length if (TextBox_Password.Text.Length < 8) { Label_Error.Visible = true; Label_Error.Text = "Password must be at least 8 characters"; } // Checks whether the passBox is greater than 8 characters in length else if (TextBox_Password.Text.Length > 50) { Label_Error.Visible = true; Label_Error.Text = "Password must be 50 characters or less"; } else { Label_Error.Visible = false; } }
/// <summary> /// Occurs when the user change the text inside the userPassword box /// </summary> private void TextBox_Password_TextChanged(object sender, EventArgs e) { if (TextBox_Password.Text.Length > 0) { Button_PasswordVisibility.Show(); } else { Button_PasswordVisibility.Hide(); } }