コード例 #1
0
ファイル: Form1.cs プロジェクト: syager42/BasicRegistration
        //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();
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: syager42/BasicRegistration
        //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();
            }
        }