private void tsbImprimir_Click(object sender, EventArgs e) { try { if (this.dgvControles.Rows.Count != 0 && this.dgvControles.Rows != null) { //vpListadoControles vistaPreviaListadoControles = new vpListadoControles(); //vistaPreviaListadoControles.idtambo = idtambo; //vistaPreviaListadoControles.Show(); vpListadoControlesPorFecha vp = new vpListadoControlesPorFecha(); vp.Show(); } else { Tambo tambo = new Tambo(); Tambo_Negocio tambo_Negocio = new Tambo_Negocio(); tambo = tambo_Negocio.RecuperarUno(idtambo); MessageBox.Show("No se encontraron controles en el tambo " + tambo.Nombre_tambo, "Error al imprimir", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ocurrió un error", MessageBoxButtons.OK); } }
private void btnImprimir_Click(object sender, EventArgs e) { try { Animal animal = new Animal(); //vpHistorialProduccion vistaPreviaHistorialProd = new vpHistorialProduccion(); animal.Rp = Convert.ToInt32(this.dgvHistorialProduccion.CurrentRow.Cells["rp"].Value); vpListadoControlesPorFecha vp = new vpListadoControlesPorFecha(animal); vp.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ocurrió un error", MessageBoxButtons.OK); } }