Exemplo n.º 1
0
        private void button14_Click(object sender, EventArgs e)
        {
            string x = "";

            foreach (DataGridViewRow row in dataGridView2.Rows)
            {
                if (row.Cells[4].Value != null)
                {
                    bool checkedCell = (bool)row.Cells[4].Value;
                    if (checkedCell)
                    {
                        if (row.Cells[2].Value.ToString() != "0")
                        {
                            string id   = row.Cells["maDG"].Value.ToString();
                            DGMod  sach = new DGMod();
                            sach.DelData(id);
                        }
                        else
                        {
                            x = x + row.Cells["maDG"].Value.ToString() + " " + row.Cells["ten"].Value.ToString() + ", ";
                        }
                    }
                    ;
                }
                ;
            }
            ;
            if (x != "")
            {
                MessageBox.Show("Độc giả " + x + "  chưa trả sách không được xóa!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            loadgrvdg();
        }