private void btnEdit_Click(object sender, EventArgs e) { var selectedId = getSelectedId(); if (selectedId < 0) { MessageBox.Show("Please select a student record."); return; } var student = studentTable.GetStudent(selectedId); AddStudent addStudentWindow = new AddStudent(student); addStudentWindow.MdiParent = this.MdiParent; addStudentWindow.Show(); }