private void button12_Click(object sender, EventArgs e) { foreach (DataGridViewRow row in dataGridView1.Rows) { if (row.Cells[3].Value != null) { bool checkedCell = (bool)row.Cells[3].Value; if (checkedCell) { string id = row.Cells["maS"].Value.ToString(); SachMod sach = new SachMod(); sach.DelData(id); sach.DelDatatl(id); } ; } ; } ; loadgrvdg(); }
private void button1_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Bạn có chắc muốn xóa", "xóa sách", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button2, MessageBoxOptions.ServiceNotification); switch (result) { case DialogResult.Abort: break; case DialogResult.Cancel: break; case DialogResult.Ignore: break; case DialogResult.No: break; case DialogResult.None: break; case DialogResult.OK: break; case DialogResult.Retry: break; case DialogResult.Yes: sach.DelData(iD); sach.DelDatatl(iD); MessageBox.Show("Xóa thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); break; default: break; } }