示例#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);
        }
示例#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);
        }
 private void NuevoButtton_Click_1(object sender, EventArgs e)
 {
     IDnumericUpDown1.Value        = 0;
     ModificarnumericUpDown1.Value = 0;
     FechadateTimePicker.Value     = DateTime.Now;
     NombreTextBox.Clear();
     TipocomboBox.DataSource = null;
     TelefonomaskedTextBox.Clear();
     DetalledataGridView.DataSource = null;
     LimpiarError();
     gente = new Personas();
     TipocomboBox.Refresh();
     TipocomboBox.Text = string.Empty;
 }