private void StudentsListBox_ItemCheck(object sender, ItemCheckEventArgs e) { for (var ix = 0; ix < StudentsListBox.Items.Count; ++ix) { if (ix != e.Index) { StudentsListBox.SetItemChecked(ix, false); } } RefreshStudentInfoListBox(); }
private void StudentsListBox_ItemCheck(object sender, ItemCheckEventArgs e) { if (e.NewValue == CheckState.Checked) { for (var index = 0; index < StudentsListBox.Items.Count; ++index) { if (e.Index != index) { StudentsListBox.SetItemChecked(index, false); } } } LoadInfo(); }
private void SelectedStudent(object sender, EventArgs e) { if (StudentsListBox.SelectedItem == null) { return; } var selection = (Student)StudentsListBox.SelectedItem; if (selection.Loans.Count(loan => loan.IsLoanActive()) == 0) { return; } MessageBox.Show(@"Student already has an active loan", @"Cannot select student", MessageBoxButtons.OK, MessageBoxIcon.Error); StudentsListBox.ClearSelected(); }
private void ResetForm() { //Simple Event //Resets the form to base values StudentsListBox.Items.Clear(); StudentsListBox.Items.Add("New Student"); foreach (Student s in Dependency.CurrentStudents) { StudentsListBox.Items.Add(s.StudentID); } NonDormRadio.Checked = true; DormDropDown.Enabled = false; MealPlanCombo.Enabled = false; DormDropDown.SelectedItem = "Waffle"; MealPlanCombo.SelectedItem = "B - Basic"; StudentsListBox.SelectedItem = "New Student"; StudentIDTextBox.Text = ""; NameTextBox.Text = ""; StudentsListBox.Focus(); }