private void editStudent() { ClsStudent lcStudent = (ClsStudent)lstStudents.SelectedItem; lcStudent.ViewEdit(); updateDisplay(); }
private void btnCreateStudent_Click(object sender, EventArgs e) { ClsStudent lcStudent = ClsStudent.NewStudent(cboStudentType.SelectedIndex); if (lcStudent != null && lcStudent.ViewEdit()) { ClsInstitute.StudentList.Add(lcStudent); updateDisplay(); } }
private void btnDeleteStudent_Click(object sender, EventArgs e) { if (lstStudents.SelectedIndex > -1) // something selected! { ClsStudent lcStudent = (ClsStudent)lstStudents.SelectedItem; string message = "Are you sure that you would like to delete student " + lcStudent.Name; const string caption = "Deleting Student"; DialogResult result = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); // If the yes button was pressed ... if (result == DialogResult.Yes) { ClsInstitute.StudentList.RemoveAt(lstStudents.SelectedIndex); // more efficient // ClsInstitute.StudentList.Remove(lcStudent); // alt updateDisplay(); } else { // Close(); } } }
public bool ShowDialog(ClsStudent prStudent) { _Student = prStudent; updateDisplay(); return(ShowDialog() == DialogResult.OK); }
public bool ShowDialog(ClsStudent prStudent) { _Student = prStudent; updateDisplay(); return ShowDialog() == DialogResult.OK; }