private void btnExportar_Click(object sender, EventArgs e) { bool ok = this.ValidarDatos(); if (ok) { SaveFileDialog file = new SaveFileDialog(); file.Filter = "Archivos de Excel (*.xlsx)|.xlsx"; DialogResult dlg = file.ShowDialog(); if (dlg == System.Windows.Forms.DialogResult.OK) { String buscar = this.txtBuscar.Text; Business.ConsultasMedicas bo = new Business.ConsultasMedicas(); bo.Exportar(buscar, file.FileName); } } }
private void LLenarGrid() { Business.ConsultasMedicas bo = new Business.ConsultasMedicas(); this.dataGridView1.DataSource = bo.ListaConsulta(txtBuscar.Text); }