This is probably something simple. The winforms combobox items by default can be edited by the user, how to disable this?
To make the text portion of a ComboBox non-editable, set the DropDownStyle property to "DropDownList". The ComboBox is now essentially select-only for the user. You can do this in the Visual Studio designer, or in C# like this: stateComboBox.
You'll need to rebuild the project after you add the ReadOnlyComboProvider class. Then simply drag one of these from the toolbox onto your form and set the properties via a property window or via code. Here's the code example to make the combobox readonly via code: Note: This works similiarly to tooltips...
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.
1. Set the Combobox dropdownstyle property to simple and give it a new height in the size property to stop all items from showing. After doing this the control looks like a textbox.
Set DropDownStyle = DropDownList.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With