0

This is about ComboBox used in Winforms. I need to stop the selected item being heighlighted. I know I can get it done if I set the style of the combobox to ComboBoxStyle.DropDownList. But I'm looking for a solution where I don't have to use that. Instead, at the moment what I have done is using ComboBoxStyle.DropDown. I don't have any other option, because if I set it to DropDown, I have to deal with some other issue in my code. It's due to something else which I cannot avoid. Can someone suggest an alternative pls ?

nidarshani fernando
  • 493
  • 4
  • 10
  • 26

1 Answers1

0

use the following code in your form's Paint event.

private void myForm_Paint(object sender, PaintEventArgs e)
{
    comboBox1.SelectionLength = 0;
}

or pass focus to another control in your combo box selected index changed event:

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
    comboBox2.Focus();
}
Ehsan.Saradar
  • 664
  • 6
  • 10