Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VB.NET: how to prevent user input in a ComboBox

How do you prevent user input in a ComboBox so that only one of the items in the defined list can be selected by the user?

like image 827
CJ7 Avatar asked May 05 '10 13:05

CJ7


People also ask

How do I stop 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 you make a combo box 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.

How do I disable a combobox in Visual Basic?

You simply put a textbox on top of the combobox. When the dropdown should be disable, make the combobox invisible and show the textbox.


1 Answers

Set the DropDownStyle property of the combobox to DropDownList. This will allow only items in the list to be selected and will not allow any free-form user input.

like image 158
DCNYAM Avatar answered Sep 22 '22 15:09

DCNYAM