Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
I am using ComboBox in my application.
I want to disable the text entry in that combobox, means should not edit the text displayed in combobox.
I tried making control ReadOnly, but then i can't see the list, the button is also getting locked.

Can anybody tell me what i need to do?
I know this must be simple one but i am not getting it.

Thanks,
Nagendra.
Posted
Updated 5-Aug-10 3:49am
v2

You can play around with DropDownStyle. In ComboBox.DropDownStyle
 
Share this answer
 
On the designer select your ComboBox then navigate its properties and change DropDownStyle from DropDown to DropDownList
 
Share this answer
 
Comments
nagendrathecoder 5-Aug-10 9:47am    
Thanks man, it worked.
See, i know it'll be simple, but probably my brain has stopped working at the moment. :D
Thanks again.
nagendrathecoder 5-Aug-10 9:48am    
Reason for my vote of 5
Correct answer
You could use an indicator variable to indicate that the combobox is disabled and simply discard any changes in the change event.

Good luck!
 
Share this answer
 
Comments
Sauro Viti 5-Aug-10 9:47am    
Reason for my vote of 1
Don't re-invent the wheel: the DropDownStyle already exists for this task
E.F. Nijboer 5-Aug-10 11:11am    
Check. I thought the value mustn't change but the user must be able to look into the values. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900