/* * Button (Edit Student) - Edit Student Code behind */ private void btnEditStudent_Click(object sender, EventArgs e) { try { //declare and initialise vars/objs int studentID = int.Parse(dgvViewStudentList.SelectedRows[0].Cells[0].Value.ToString()); //open Edit Student form EditStudent editStudent = new EditStudent(); EditStudent.SearchStudentID = studentID; MessageBox.Show("Student ID sent to DB is " + EditStudent.SearchStudentID); editStudent.Show(); Hide(); } catch (ArgumentOutOfRangeException ae) { MessageBox.Show("Please select a line to edit by clicking on it - No records to Edit until line is Selected", "System Notice", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (FormatException fe) { MessageBox.Show("Something went wrong with the selection - Make Sure You Click on Record before clicking OK", "System Notice", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void exitStudentToolStripMenuItem_Click(object sender, EventArgs e) { EditStudent editStudent = new EditStudent(); editStudent.Show(); }