How to disable item editing in combobox?vb.Net
-
-
the default setting of combo box enable user to edit the listed in combobox just like normal textbox, but i cant find any property that can disable this option, i wan the combobox to be read-only to user...how i going to do that?? anyone can help me??VB.Net
Try this:
Me.ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList
Or just set it in the designer. The defintions for
ComboBoxStyle
are: DropDown The text portion is editable. The user must click the arrow button to display the list portion. DropDownList The user cannot directly edit the text portion. The user must click the arrow button to display the list portion. Simple The text portion is editable. The list portion is always visible. --Colin Mackay--"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown) Enumerators in .NET: See how to customise foreach loops with C#
-
Try this:
Me.ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList
Or just set it in the designer. The defintions for
ComboBoxStyle
are: DropDown The text portion is editable. The user must click the arrow button to display the list portion. DropDownList The user cannot directly edit the text portion. The user must click the arrow button to display the list portion. Simple The text portion is editable. The list portion is always visible. --Colin Mackay--"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown) Enumerators in .NET: See how to customise foreach loops with C#
-
thanks man, ur solution works! however seems like the combobox will no default value when form loaded, the combobox is empty how i going to set the first item in the combobox to be the default item when form is loaded?
Use
SelectedIndex
orSelectedText
--Colin Mackay--"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown) Enumerators in .NET: See how to customise foreach loops with C#
-
Use
SelectedIndex
orSelectedText
--Colin Mackay--"In the confrontation between the stream and the rock, the stream always wins - not through strength but perseverance." (H. Jackson Brown) Enumerators in .NET: See how to customise foreach loops with C#