private void OnButtonCreateClick(object sender, EventArgs e) { int index = this.cbSubjects.SelectedIndex; if (index < 0 || index >= avaialableSubjects.Count) { return; } var sj = avaialableSubjects[index]; var report = new SubjectReport(); SQLConnections.FillResultReportsBySubject(this.teacherID, sj.ID, this.start, this.end, report); this.Close(); new SubjectReportForm(report).ShowDialog(); }