private void comboBoxBaud_SelectedIndexChanged(object sender, EventArgs e) { if (comboBoxBaud.SelectedItem.ToString() == CUSTOM_BAUD) { DialogCustomBaud baudDialog = new DialogCustomBaud(); baudDialog.ShowDialog(); if (CustomBaud == "") { comboBoxBaud.SelectedIndex = 0; } else { if (comboBoxBaud.Items.Count != (comboBoxBaud.SelectedIndex + 1)) {// currently another custom value. comboBoxBaud.Items.RemoveAt(comboBoxBaud.SelectedIndex + 1); } comboBoxBaud.Items.Add(CustomBaud); comboBoxBaud.SelectedIndex += 1; } } }
private void comboBoxBaud_SelectedIndexChanged(object sender, EventArgs e) { if (comboBoxBaud.SelectedItem.ToString() == CUSTOM_BAUD) { DialogCustomBaud baudDialog = new DialogCustomBaud(); baudDialog.ShowDialog(); if (CustomBaud == "") { comboBoxBaud.SelectedIndex = 0; } else { if (comboBoxBaud.Items.Count != (comboBoxBaud.SelectedIndex + 1)) {// currently another custom value. comboBoxBaud.Items.RemoveAt(comboBoxBaud.SelectedIndex + 1); } comboBoxBaud.Items.Add(CustomBaud); comboBoxBaud.SelectedIndex += 1; } } }