How to disable editing of elements in combobox for c#?
Use the ComboStyle property:
comboBox.DropDownStyle = ComboBoxStyle.DropDownList;
This is another method I use because changing DropDownSyle
to DropDownList
makes it look 3D and sometimes its just plain ugly.
You can prevent user input by handling the KeyPress
event of the ComboBox like this.
private void ComboBox1_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = true;
}
Yow can change the DropDownStyle in properties to DropDownList. This will not show the TextBox for filter.
(Screenshot provided by FUSION CHA0S.)