开发者

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

开发者 https://www.devze.com 2022-12-31 19:26 出处:网络
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?

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 开发者_如何学Gofor a desktop application.


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


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;


Set the ComboBox.DropDownStyle property to DropDownList - that should give you the behaviour you need

0

精彩评论

暂无评论...
验证码 换一张
取 消