private bool Error(int error) { bool paso = false; //Tiramos un error para cada campo que no este lleno if (error == 1 && ArticuloIdNumericUpDown.Value == 0) { ArticuloIdErrorProvider.SetError(ArticuloIdNumericUpDown, "Ingrese un ID");//Tiramos un error si ArticuloIdNumericUpDown que no está lleno. paso = true; } if (error == 2 && DescripcionTextBox.Text == string.Empty) { DescripcionErrorProvider.SetError(DescripcionTextBox, "Ingrese una Dirección");//Tiramos un error si DescripcionTextBox que no está lleno. paso = true; } if (error == 2 && PrecioTextBox.Text == string.Empty) { PrecioErrorProvider.SetError(PrecioTextBox, "Ingrese una Precio"); //Tiramos un error si PrecioTextBox que no está lleno. paso = true; } if (error == 2 && ExistenciaTextBox.Text == string.Empty) { ExistErrorProvider.SetError(ExistenciaTextBox, "Ingrese una Cuant@s hay en Existencia"); //Tiramos un error si ExistenciaTextBox que no está lleno. paso = true; } if (error == 2 && CantCotizTextBox.Text == string.Empty) { CantCotErrorProvider.SetError(CantCotizTextBox, "Ingrese una Cantidad que desea comprar");//Tiramos un error si CantCotizTextBox que no está lleno. paso = true; } return(paso); }
private bool Validar() { if (string.IsNullOrWhiteSpace(descripcionTextBox.Text)) { DescripcionErrorProvider.SetError(descripcionTextBox, "Por favor digite la descripcion"); return(false); } return(true); }