private void buttonAddSt_Click(object sender, EventArgs e) { var wnd = new DialogAdd(); wnd.Lecturers = this.Lecturers; if (wnd.ShowDialog() == DialogResult.OK) { bs.ResetBindings(false); listBoxStudents.DataSource = null; listBoxStudents.DataSource = (comboBoxLecturer.SelectedItem as Lecturer).Students; listBoxStudents.DisplayMember = "FIO"; } }
private void ButtonChange_Click(object sender, EventArgs e) { if (listBoxStudents.SelectedItem == null) { return; } var wnd = new DialogAdd(); wnd.Lecturers = this.Lecturers; var st = listBoxStudents.SelectedItem as Student; wnd.Student = st; wnd.ShowDialog(); listBoxStudents.DataSource = null; listBoxStudents.DataSource = (comboBoxLecturer.SelectedItem as Lecturer).Students;// listBoxStudents.DisplayMember = "FIO"; }