private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { listBox1.Items.Clear(); try { if (comboBox1.SelectedIndex < dividerLocation) { Command c = commands[comboBox1.SelectedItem.ToString().ToUpper()]; for (int i = 0; i < c.NumberOfParameters; i++) { listBox1.Items.Add("Name: " + c.ParameterNames[i] + " Length: " + c.ParameterLengths[i]); } label1.Text = "Command ID: 0x" + c.HexID.ToString("X"); } else { throw new KeyNotFoundException(); } } catch (KeyNotFoundException) { try { SuperCommand s = superCommands[comboBox1.SelectedItem.ToString().ToUpper()]; for (int i = 0; i < s.NumberOfParameters; i++) { listBox1.Items.Add("Name: " + s.ParameterNames[i] + " Length: " + s.ParameterLengths[i]); } label1.Text = ""; } catch (KeyNotFoundException) { label1.Text = ""; } } }