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.ID, 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;
                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.Remove(lcStudent.ID);// Delete from parent
                    //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;
 }
예제 #5
0
 public bool ShowDialog(ClsStudent prStudent)
 {
     _Student = prStudent;
     updateDisplay();
     return(ShowDialog() == DialogResult.OK);
 }