How to install combobox for reading or the user cannot write in the combo box, only can select data?

I'm having a problem setting the combo property, so that only the user can select the values ​​that form the data, but I cannot write to the combo box.

How can I do this in C #?

+36
c # combobox
Jun 17 '10 at 11:00
source share
6 answers

Just change DropDownStyle to DropDownList . Or, if you want it to be fully readable, you can set Enabled = false , or if you don't like the look, I sometimes have two controls: one read-only text field and one combo box, and then hide the combo and show the text box if it should be completely readonly and vice versa.

+90
Jun 17 '10 at 11:03
source share

I think you want to change the "DropDownStyle" parameter to "DropDownList".

+12
Jun 17 '10 at 11:04 on
source share

In the keypress event handler:

 e.Handled = true; 
+12
Jul 15 '11 at 12:08
source share

Make DropDownStyle in DropDownList

 stateComboBox.DropDownStyle = ComboBoxStyle.DropDownList; 
+9
Dec 09 '13 at 7:24
source share

The solution is to change the DropDownStyle property to DropDownList. This will help.

+4
Jun 18 2018-10-18T00
source share

Try the following:

  private void comboBox1_KeyDown(object sender, KeyEventArgs e) { // comboBox1 is readonly e.SuppressKeyPress = true; } 
+3
May 18 '14 at 12:05
source share



All Articles