private void DescripcionTextBox_KeyPress(object sender, KeyPressEventArgs e) // De la descripcion a la fecha de creacion { if ((int)e.KeyChar == (int)Keys.Enter) { FechaCreacionDateTimePicker.Focus(); } }
private bool Validar() //Funcion que valida todo el registro { bool paso = true; MyErrorProvider.Clear(); if (DescripcionTextBox.Text == string.Empty) { MyErrorProvider.SetError(DescripcionTextBox, "El campo \"Descripcion\" no puede estar vacio"); // Validando que la descripcion no este vacia DescripcionTextBox.Focus(); paso = false; } if (TiposTrabajosBLL.Existe(DescripcionTextBox.Text) == true) // Validando que la descripcon no exista { MyErrorProvider.SetError(DescripcionTextBox, "Este tipo de trabajo ya existe"); DescripcionTextBox.Focus(); paso = false; } if (FechaCreacionDateTimePicker.Value > DateTime.Now) // Validando que la fecha de creacion no sea mayor a la actual { MyErrorProvider.SetError(FechaCreacionDateTimePicker, "La fecha de ingreso no puede ser mayor a la fecha actual"); FechaCreacionDateTimePicker.Focus(); paso = false; } return(paso); }
private bool Validar() { MyErrorProvider.Clear(); bool paso = true; if (string.IsNullOrWhiteSpace(NombreTextBox.Text)) { MyErrorProvider.SetError(NombreTextBox, "El campo nombre no puede estar vacío"); NombreTextBox.Focus(); paso = false; } if (string.IsNullOrWhiteSpace(CategoriaComboBox.Text)) { MyErrorProvider.SetError(CategoriaComboBox, "Debe de seleccionar una categoria"); CategoriaComboBox.Focus(); paso = false; } if (FechaCreacionDateTimePicker.Value >= FechaEntregaDateTimePicker.Value) { MyErrorProvider.SetError(FechaCreacionDateTimePicker, "La fecha de creacion no puede ser mayor \nque la fecha de entrega de la asignacion"); FechaCreacionDateTimePicker.Focus(); paso = false; } if (string.IsNullOrWhiteSpace(DescripcionRichTextBox.Text)) { MyErrorProvider.SetError(DescripcionRichTextBox, "El campo descripción no puede estar vacío"); DescripcionRichTextBox.Focus(); paso = false; } if (string.IsNullOrWhiteSpace(AsignaturaTextBox.Text)) { MyErrorProvider.SetError(AsignaturaTextBox, "El campo asignatura no puede estar vacío"); AsignaturaTextBox.Focus(); paso = false; } return(paso); }