-2

I got a combobox and i want that the string of the selected index will not be possible to edit
how can i do it?
thanks

cheziHoyzer
  • 4,803
  • 12
  • 54
  • 81

2 Answers2

3

If you want to block the ability to edit the textbox portion of a combobox you should set

 combobox1.DropDownStyle = ComboBoxStyle.DropDownList;

or set the same property using the Properties list in the Form Designer

Steve
  • 213,761
  • 22
  • 232
  • 286
0
  private void combobox1_KeyPress(object sender, KeyPressEventArgs e)
  {
      e.Handled = true;
  }
RAS
  • 8,100
  • 16
  • 64
  • 86
Hitesh
  • 1