private void MainForm_Load(object sender, EventArgs e) { // this.Hide(); quizDocument1 = QuizDocument using (RegisterForm rf = new RegisterForm()) { if (rf.ShowDialog(this) == DialogResult.OK) { professor = rf.GetProfessorData(); student = rf.GetStudentData(); if (professor == null || student == null) { MessageBox.Show(Resources.MainForm_MainForm_Load_Error, Resources.MainForm_MainForm_Load_Error_Title, MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Restart(); } } else { Application.Exit(); } } }
private void RegisterForm_FormClosing(object sender, FormClosingEventArgs e) { student = new Student() { FirstName = txtStudentFirstName.Text, ID = txtStudentID.Text, LastName = txtStudentLastName.Text, Mail = txtStudentMail.Text }; professor = new Professor() { FirstName = txtProfessorFirstName.Text, LastName = txtProfessorLastName.Text, Mail = txtProfessorMail.Text, Subject = txtProfessorSubject.Text }; }