internal void SetData(Student S) { Data = S; StudentNameTextBox.Text = Data.Name; ComboBoxGroup.SelectedItem = Data.Group; if (Gender.Female == S.Gender) { RadioButtonFemale.Checked = true; } else { RadioButtonMale.Checked = true; } }
public ScoreRowAdd(Form owner, Student Student) { InitializeComponent(); this.Owner = owner; this.Student = Student; this.Text = "Добавить оценку " + this.Student.Name; СomboBoxSubject.DataSource = ((MainForm)this.Owner).Subjects; СomboBoxSubject.SelectedIndex = -1; ComboBoxScore.DataSource = new List<Score>() { Score.Bad, Score.Unsatisfactory, Score.Satisfactory, Score.Good, Score.Excellent }; ComboBoxScore.SelectedIndex = -1; //ComboBoxScore.Validating += delegate(object sender, System.ComponentModel.CancelEventArgs e) //{ // ComboBox CB = (ComboBox)sender; // if (CB.SelectedIndex < 0) // { // e.Cancel = true; // MessageBox.Show("Выберите значение"); // MainForm MainForm = (MainForm)this.Owner; // MainForm.ErrorProvider.SetError(this, "Choose a value"); // } //}; //СomboBoxSubject.Validating += delegate(object sender, System.ComponentModel.CancelEventArgs e) //{ // ComboBox CB = (ComboBox)sender; // if (CB.SelectedIndex < 0) // { // e.Cancel = true; // MessageBox.Show("Выберите значение"); // } //}; ComboBoxScore.Validating += new CancelEventHandler(ComboBoxScore_Validating); }