//invokes UpdatePageData using the clicked staff member off the list as the passed parameter private void StaffListBox_SelectedIndexChanged(object sender, EventArgs e) { if (CheckItemSelected(StaffListBox)) { UpdatePageData(storedStaff[StaffListBox.SelectedIndex]); StaffListBox.SetSelected(StaffListBox.SelectedIndex, false); } }
public void SelectNewWorker(int workerId) { StaffListBox.SelectionChanged -= StaffListBox_SelectionChanged; StaffListBox.SelectedValue = workerId; StaffListBox.SelectionChanged += StaffListBox_SelectionChanged; StaffListBox_SelectionChanged(null, null); if (StaffListBox.SelectedItem != null) { StaffListBox.ScrollIntoView(StaffListBox.SelectedItem); } }