Reputation: 2213
This is probably something simple. The winforms combobox items by default can be edited by the user, how to disable this?
Upvotes: 25
Views: 45247
Reputation: 645
two Method that help you Stop User to not Edit DropDownList:
A. using Programming code:
DropDownListName.DropDownStyle = ComboBoxStyle.DropDownList;\
B. using Design properties of Visual Studio
Set DropDownStyle = DropDownList.
I hope this well help you.
Upvotes: 1
Reputation: 47530
Set the ComboBox.DropDownStyle to 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.
Upvotes: 15
Reputation: 3454
Try setting the DropDownStyle property to DropDownList. Style of Simple makes it like a listbox, Combobox is what you are seeing allowing editing, and DropDownList only allows user to select.
Upvotes: 1