如何设置组合框只读或用户在组合框中不能写只能选择给定的项目? [英] How do I set combobox read-only or user cannot write in a combo box only can select the given items?
本文介绍了如何设置组合框只读或用户在组合框中不能写只能选择给定的项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我现在面临一个问题,设置组合属性,这样只有用户可以选择的值形式给出的项目,但我不能在组合框中书写。
I am facing a problem in setting the combo property such that only user can select the values form given items, but I cannot write in the combo box.
如何我可以在C#这样做呢?
How can I do so in C#?
推荐答案
只要改变 DropDownStyle
来的DropDownList
。或者,如果你想让它完全只读你可以设置已启用=假
,或者如果你不喜欢的是,看我有时有两个控件,一个文本框只读一组合框,然后隐藏组合和显示文本,如果它应该是完全只读的,反之亦然。
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.
这篇关于如何设置组合框只读或用户在组合框中不能写只能选择给定的项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文