Ejemplo n.º 1
0
        //opens up the addEditStudent form with functionality to add new student
        private void buttonNewStudent_Click(object sender, EventArgs e)
        {
            addEditStudent addEditForm = new addEditStudent();

            addEditForm.addStudent = true;
            DialogResult result = addEditForm.ShowDialog();

            if (result == DialogResult.OK)
            {
                selectedStudent         = addEditForm.student;
                textBoxShowStudent.Text = selectedStudent.StudentID.ToString();
                this.DisplayStudent();
            }
        }
Ejemplo n.º 2
0
        //opens up the addEditStudent form with functionality to edit the current student
        private void buttonEditStudent_Click(object sender, EventArgs e)
        {
            addEditStudent addEditForm = new addEditStudent();

            addEditForm.addStudent = false;
            addEditForm.student    = selectedStudent;
            DialogResult result = addEditForm.ShowDialog();

            if (result == DialogResult.OK || result == DialogResult.Retry)
            {
                selectedStudent = addEditForm.student;
                this.DisplayStudent();
            }
            else if (result == DialogResult.Abort)
            {
                textBoxShowStudent.Text = "";
                this.ClearControls();
            }
        }