private void button2_Click(object sender, EventArgs e) { FileFolderDialog sfd = new FileFolderDialog(); if (sfd.ShowDialog() == DialogResult.OK) { Thread t = new Thread(() => { foreach (DataGridViewRow row in dataGridView1.Rows) { row.DefaultCellStyle.BackColor = Color.Yellow; ssStatus.Text = String.Format("Đang xử lý {0}!", row.Cells[1].Value.ToString()); try { List <string> images = listAllImages(row.Cells[0].Value.ToString()); ImagesFoldersToPdf(images, sfd.SelectedPath, row.Cells[1].Value.ToString()); ssStatus.Text = String.Format("Xử lý {0} hoàn tất!", row.Cells[1].Value.ToString()); row.DefaultCellStyle.BackColor = Color.LimeGreen; } catch (Exception ex) { ssStatus.Text = String.Format("Xử lý {0} Lỗi!", row.Cells[1].Value.ToString()); row.DefaultCellStyle.BackColor = Color.Red; MessageBox.Show(ex.ToString(), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } MessageBox.Show(String.Format("Completed!\nAll File Save here \"{0}\"", sfd.SelectedPath), "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); }); t.Start(); } }
private void addToolStripMenuItem_Click(object sender, EventArgs e) { FileFolderDialog ffd = new FileFolderDialog(); if (ffd.ShowDialog() == DialogResult.OK) { AddDataToTable(ffd.SelectedPath); } }