Andrey Ischencko
Andrey Ischencko

Reputation: 790

How to disable option of typing user values to Windows Forms Combobox?

I have winforms combobox. I have list of predefined values that i put into Items collection. I want to let user choose only this values, but not to type their own. What should i do?

Upvotes: 0

Views: 206

Answers (2)

Steve
Steve

Reputation: 216293

Set the property DropDownStyle to ComboBoxStyle.DropDownList

comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;

Specifies that the list is displayed by clicking the down arrow and that the text portion is not editable. This means that the user cannot enter a new value. Only values already in the list can be selected. The list displays only if AutoCompleteMode is Suggest or SuggestAppend.

Upvotes: 1

EZI
EZI

Reputation: 15364

Set its DropDownStyle to DropDownList

enter image description here

Upvotes: 2

Related Questions