private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { int recordNo = (int)dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value; FrmAddStudentRecord frmAddStudentRecord = new FrmAddStudentRecord(recordNo); DialogResult dr = frmAddStudentRecord.ShowDialog(this); if (dr == DialogResult.OK) { ViewStudentRecord(); } }
private void btnNew_Click(object sender, EventArgs e) { DialogResult dr2; FrmAddStudentRecord frmAddStudentRecord = new FrmAddStudentRecord(); DialogResult dr = frmAddStudentRecord.ShowDialog(this); while (dr == DialogResult.OK) { ViewStudentRecord(); dr2 = frmAddStudentRecord.ShowDialog(this); if (dr2 == DialogResult.Cancel) { break; } } }