private void TxtPass1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { TxtPass2.Focus(); } }
private void TxtPass2_TextChanged(object sender, EventArgs e) { if (TxtPass2.Text.Trim().Length > 0) { if (TxtPass1.Text != TxtPass2.Text) { errorP1.SetError(TxtPass2, "Las contraseñas no coinciden."); TxtPass2.Focus(); } else { errorP1.SetError(TxtPass2, ""); } } }
public bool ValidarUsu() { bool retorno = true; if (string.IsNullOrEmpty((TxtUsuario.Text))) { errorP1.SetError(TxtUsuario, "Debe ingresar el usuario."); TxtUsuario.Focus(); retorno = false; } else { errorP1.SetError(TxtUsuario, ""); } if (string.IsNullOrEmpty((TxtPass1.Text))) { errorP1.SetError(TxtPass1, "Debe ingresar la contraseña."); TxtPass1.Focus(); retorno = false; } else { errorP1.SetError(TxtPass1, ""); } if (string.IsNullOrEmpty((TxtPass2.Text))) { errorP1.SetError(TxtPass2, "Debe confirmar la contraseña."); TxtPass2.Focus(); retorno = false; } else { errorP1.SetError(TxtPass2, ""); if (TxtPass1.Text != TxtPass2.Text) { errorP1.SetError(TxtPass2, "Las contraseñas no coinciden."); TxtPass2.Focus(); retorno = false; } else { errorP1.SetError(TxtPass2, ""); } } if (LueTipoUsuario.ItemIndex < 0) { errorP1.SetError(LueTipoUsuario, "Debe seleccionar un tipo de ususario."); LueTipoUsuario.Focus(); retorno = false; } else { errorP1.SetError(LueTipoUsuario, ""); } return(retorno); }