// データをエクセルへエクスポート private void btnExport_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); dt = (DataTable)dgvBatchNo.DataSource; ExcelClass xl = new ExcelClass(); xl.ExportToExcel(dt); //xl.ExportToCsv(dt, System.Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + @"\ipqcdb.csv"); }