Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to change a Winforms combobox to disable typing into it?

Tags:

c#

.net

winforms

So that it just allows selecting items already inside, but not allow typing/editing the text inside it?

like image 429
Joan Venge Avatar asked Mar 02 '10 23:03

Joan Venge


People also ask

How do I disable typing in ComboBox?

Right click the Combo Box you want to disable typing, then click Properties from the right-clicking menu. See screenshot: 3. In the Properties dialog box, select 2 – fmStyleDropDownList from the Style drop-down list, and then close this dialog box.

How do I make my ComboBox not editable?

To make the text portion of a ComboBox non-editable, set the DropDownStyle property to "DropDownList". The ComboBox is now essentially select-only for the user. You can do this in the Visual Studio designer, or in C# like this: stateComboBox.

How do I make my ComboBox read only?

Just change the DropDownStyle to DropDownList . Or if you want it completely read only you can set Enabled = false , or if you don't like the look of that I sometimes have two controls, one readonly textbox and one combobox and then hide the combo and show the textbox if it should be completely readonly and vice versa.


1 Answers

Set ComboBox.DropDownStyle to ComboBoxStyle.DropDownList.

like image 56
Shane Fulmer Avatar answered Oct 04 '22 03:10

Shane Fulmer