Пример #1
0
 private void TxtCorreo_Validated(object sender, EventArgs e)
 {
     if (Validaciones.ValidarEmail(txtCorreo.Text))
     {
         flag = true;
         errorProvider1.Clear();
     }
     else
     {
         flag = false;
         errorProvider1.SetError(txtCorreo, "Dirección no válida");
         txtCorreo.SelectAll(); //selecciona todo lo de la casilla
         txtCorreo.Focus();     //se posiciona ahí de nuevo
     }
 }
Пример #2
0
        private bool validarCampos()
        {
            bool bandera = true;

            if (txtPrimerNombre.Text == String.Empty)
            {
                bandera = false;
                listaErrores.SetError(txtPrimerNombre, "Ingrese el nombre del profesor");
            }
            if (txtPrimerApellido.Text == String.Empty)
            {
                bandera = false;
                listaErrores.SetError(txtPrimerApellido, "Ingrese el apellido del profesor");
            }
            if (txtTelefono.Text == String.Empty)
            {
                bandera = false;
                listaErrores.SetError(txtTelefono, "Ingrese el teléfono del profesor");
            }
            if (txtCorreo.Text == String.Empty)
            {
                bandera = false;
                listaErrores.SetError(txtCorreo, "Ingrese el correo del profesor");
            }
            if (!Validaciones.ValidarTelefono(txtTelefono.Text))
            {
                bandera = false;
                listaErrores.SetError(txtTelefono, "Ingrese un teléfono válido");
            }
            if (!Validaciones.ValidarEmail(txtCorreo.Text))
            {
                bandera = false;
                listaErrores.SetError(txtCorreo, "Ingrese un correo válido");
            }
            return(bandera);
        }