private void pictureBox2_Click(object sender, EventArgs e)
        {
            frmBookAdd frm = new frmBookAdd(this);

            frm.btnUpdate.Enabled = false;
            frm.ShowDialog();
        }
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            string colName = dataGridView1.Columns[e.ColumnIndex].Name;

            if (colName == "Edit")
            {
                frmBookAdd frm = new frmBookAdd(this);
                frm.btnUpdate.Enabled       = true;
                frm.btnSave.Enabled         = false;
                frm.txtISBN.Text            = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
                frm.txtBookTitle.Text       = dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString();
                frm.txtAuthor.Text          = dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString();
                frm.txtPublicationYear.Text = dataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString();
                frm.txtLanguage.Text        = dataGridView1.Rows[e.RowIndex].Cells[5].Value.ToString();
                frm.txtCategory.Text        = dataGridView1.Rows[e.RowIndex].Cells[6].Value.ToString();
                frm.txtNoOfCopies.Text      = dataGridView1.Rows[e.RowIndex].Cells[7].Value.ToString();
                frm.txtCurrentCopies.Text   = dataGridView1.Rows[e.RowIndex].Cells[8].Value.ToString();
                frm.ShowDialog();
            }
            else if (colName == "Delete")
            {
                if (MessageBox.Show("Are you sure you want to delete this record?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    cn.Open();
                    cm = new SqlCommand("delete from tblBook where isbn like'" + dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString() + "'", cn);
                    cm.ExecuteNonQuery();
                    cn.Close();
                    MessageBox.Show("Your record has been successfully deleted", "Delete", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    LoadRecord();
                }
            }
        }