ComboBox Enable/Disable


Any way to make the combobox not give to write without having to put the value disable?
When I put the value disable the format of the combobox is different.


If you NEVER want the user to be able to type into the combobox, return TRUE in the KeyDown event. Of course, in that case why use a combobox?

A better solution might be to set and check a global Boolean for when you want to allow typing into that field and return true in the KeyDown event based on that global value.

Also, be sure to check for and handle the cursor keys to run the menu items.

Hi Dale, how do i prevent the drop down part from coming down on a locked/disable combo box??

Eg i have a screen with combobox that is use for data entry and this same screen is use when user is login as guest ( no data entry) and I don’t want them to be able change the information in the combobox or clicking on the dropdown part.

To prevent the dropdown from activating, return true in the ‘MouseDown’ event. To prevent the user from changing the value via keyboard, you could reset the listIndex in the ‘TextChanged’ event (you would need to save the original value into a property of the window or subclass).