private void apply_btn_Click(object sender, EventArgs e) { if (studentName.Text == "") { Hide(); return; } if (m_student == null) { m_student = new Student(); GlobalData.addStudent(m_student); } m_student.Name = studentName.Text; m_student.Group = groupName.Text; m_student.clearSubjects(); foreach (Subject subject in selectedSubjects.Items) { m_student.addSubject(subject); } DialogResult = DialogResult.Yes; Hide(); }