Home »

How can you prevent users of an application from editing the text in the ComboBox controls in .NET 4.0?

Question ListCategory: C#.NETHow can you prevent users of an application from editing the text in the ComboBox controls in .NET 4.0?
jully882 author asked 9 years ago
1 Answers
ethanbrown author answered 8 years ago

The ComboBox class contains the DropDownStyle property, which is used to define the display style of the items in the ComboBox control. The DropDownStyle property accepts a value from the ComboBoxStyle enumeration, which contains three members to define the styles for the items: Simple, DropDownList, and DropDown. The DropDownList value of the ComboBoxStyle enumeration is selected to set a ComboBox control as non- editable by users, as shown in the following code snippets: Code for VB: ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList Code for C#: ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList;

Please login or Register to Submit Answer