private void dgvDegrees_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0 && e.ColumnIndex == 4) //Edit { int did = (int)dgvDegrees.CurrentRow.Cells[0].Value; frmNewDegree degObj = new frmNewDegree(did); degObj.Show(); } else if (e.RowIndex >= 0 && e.ColumnIndex == 5) //Delete { var result = MessageBox.Show("Are you sure", "?", MessageBoxButtons.YesNo); if (result == System.Windows.Forms.DialogResult.Yes) { int did = (int)dgvDegrees.CurrentRow.Cells[0].Value; Boolean flag = DAL.DegreesDAL.DeleteDegree(did); if (flag == true) { LoadDegrees(); MessageBox.Show("Record has been deleted"); } } } }
private void newDegreeToolStripMenuItem_Click(object sender, EventArgs e) { frmNewDegree newDeg = new frmNewDegree(); newDeg.ShowDialog(); }