private void pdfButton_Click(object sender, EventArgs e) { if (todosLosDatos.Rows.Count > 0) { Imprimir prints = new Imprimir(); DataTable dt = (DataTable)(todosLosDatos.DataSource); prints.exportarPDF(searchBy, dt, modulos.Text); } else { MessageBox.Show("No existen datos para exportarlos !!!", "Info"); } }