コード例 #1
0
        private void editStudent()
        {
            ClsStudent lcStudent = (ClsStudent)lstStudents.SelectedItem;

            lcStudent.ViewEdit();
            updateDisplay();
        }
コード例 #2
0
        private void btnCreateStudent_Click(object sender, EventArgs e)
        {
            ClsStudent lcStudent = ClsStudent.NewStudent(cboStudentType.SelectedIndex);

            if (lcStudent != null && lcStudent.ViewEdit())
            {
                ClsInstitute.StudentList.Add(lcStudent);
                updateDisplay();
            }
        }
コード例 #3
0
        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();
                }
            }
        }
コード例 #4
0
 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;
 }