private void TxtUsuario_Validating(object sender, CancelEventArgs e) { if (string.IsNullOrEmpty((TxtUbicacion.Text))) { errorP1.SetError(TxtUbicacion, "Debe ingresar la ubicación."); TxtUbicacion.Focus(); } else { errorP1.SetError(TxtUbicacion, ""); } }
public bool Validar() { bool retorno = true; if (string.IsNullOrEmpty((TxtUbicacion.Text))) { errorP1.SetError(TxtUbicacion, "Debe ingresar la ubicación."); TxtUbicacion.Focus(); retorno = false; } else { errorP1.SetError(TxtUbicacion, ""); } return(retorno); }