Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# how can I make a listbox dropdown like a combobox does?

Tags:

c#

winforms

How can I make a listbox dropdown like a combobox?

Or is it possible to configure a combobox so that the user can't add values but rather only select from the available list of values?

This is for a desktop application.

like image 228
codingguy3000 Avatar asked May 25 '10 14:05

codingguy3000


2 Answers

The ComboBox control has a DropDownStyle property used to set this. Set it to DropDownList.

like image 190
Mashmagar Avatar answered Oct 14 '22 01:10

Mashmagar


Set the DropDownStyle to 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.

like:

DropDownStyle = DropDownList;
like image 24
tanascius Avatar answered Oct 14 '22 00:10

tanascius