private void patientComboBox_SelectedIndexChanged(object sender, EventArgs e) { TestScoreListView.Items.Clear(); testComboBox.Items.Clear(); dateComboBox.Items.Clear(); resultsButton.Enabled = false; string error = ""; List <ResultDisplay> resultList = new List <ResultDisplay>(); List <Test> testList = new List <Test>(); UserClass user = (UserClass)patientComboBox.SelectedItem; Test test = (Test)testComboBox.SelectedItem; // Displays test results for a selected user. try { if (TestSession.GetUserTests(testList, ref error, user.intUserID)) { foreach (Test tests in testList) { testComboBox.Items.Add(tests); } } else { MessageBox.Show(error); } } catch { MessageBox.Show("Error in form!"); } if (testComboBox.Items.Count == 1) { testComboBox.SelectedIndex = 0; } }