Example #1
0
        private bool Validar()
        {
            bool   realizado   = true;
            string obligatorio = "Este campo es obligatorio";

            errorProvider.Clear();

            if (string.IsNullOrWhiteSpace(IDnumericUpDown.Text))
            {
                errorProvider.SetError(IDnumericUpDown, obligatorio);
                IDnumericUpDown.Focus();
                realizado = false;
            }

            if (string.IsNullOrWhiteSpace(TipocomboBox.Text))
            {
                errorProvider.SetError(TipocomboBox, obligatorio);
                TipocomboBox.Focus();
                realizado = false;
            }

            if (string.IsNullOrWhiteSpace(PreciotextBox.Text))
            {
                errorProvider.SetError(PreciotextBox, obligatorio);
                PreciotextBox.Focus();
                realizado = false;
            }

            return(realizado);
        }
Example #2
0
        private bool Validar()
        {
            bool paso = true;

            MyErrorProvider.Clear();

            if (ResultadotextBox.Text == string.Empty)
            {
                MyErrorProvider.SetError(ResultadotextBox, "El Campo no puede estar vacio.");
                ResultadotextBox.Focus();
                paso = false;
            }
            if (TipocomboBox.Text == string.Empty)
            {
                MyErrorProvider.SetError(TipocomboBox, "El Campo no puede estar vacio.");
                TipocomboBox.Focus();
                paso = false;
            }
            if (UsuariocomboBox.Text == string.Empty)
            {
                MyErrorProvider.SetError(UsuariocomboBox, "El Campo no puede estar vacio.");
                UsuariocomboBox.Focus();
                paso = false;
            }


            return(paso);
        }