private void dgvReturn_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { //Get information about a book Book objBook = objBookServices.GetBookById(dgvReturn.CurrentRow.Cells[1].Value.ToString()); //Load form if (objFrmBookDetail == null) { objFrmBookDetail = new frmBookDetail(1, objBook); objFrmBookDetail.Show(); } else { objFrmBookDetail.Activate(); objFrmBookDetail.WindowState = FormWindowState.Normal; } }
private void dgvBorrowedList_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { //Get a breakdown of the current book Book objBook = objBookServices.GetBookById(dgvBorrowedList.CurrentRow.Cells[1].Value.ToString()); //Open Form if (objFrmBookDetail == null) { objFrmBookDetail = new frmBookDetail(1, objBook); objFrmBookDetail.Show(); } else { objFrmBookDetail.Activate(); objFrmBookDetail.WindowState = FormWindowState.Normal; } }
//View book details: View only private void dgvBook_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { //【1】Get current Click Book information Book objBook = null; try { objBook = objBookServices.GetBookById(dgvBook.CurrentRow.Cells[0].Value.ToString()); } catch (Exception ex) { MessageBox.Show("Abnormal access to book details! Specific reasons:" + ex.Message, "System Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } //【2】 Assign a value to flag actionFlag = 1; //【3】Loading a form frmBookDetail objFrmBookDetail = new frmBookDetail(actionFlag, objBook); objFrmBookDetail.Show(); }