[英]not to let user to enter value in combobox other than databound list
i have a combobox in the form which is bounded with database . 我有一个与数据库绑定的形式的组合框。
i am trying to solve two issues . 我正在努力解决两个问题。
not to let user to enter the values that are not in data list . 不要让用户输入不在数据列表中的值。
not to run code until the full value is entered . 在输入完整值之前不要运行代码。
for eg. 例如 when i enter the first letter of any value and press enter ,code is running with the values that first matched the entered word .
当我输入任何值的第一个字母并按Enter时,代码正在使用与输入的单词首次匹配的值运行。 like for 'd' code is running with no 'd001'
就像'd'代码正在运行而没有'd001'
requirement is that , no execution until the user enter or select the full value . 要求是,直到用户输入或选择完整值,才可以执行。
thanks in advance and sorry for any English related error . 在此先感谢您,并感谢与英语相关的错误。
Try below from code 从代码尝试以下
comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
You can also set the DropDownStyle
to DropDownList
from Properties window of the combobox. 您还可以设置
DropDownStyle
到DropDownList
从ComboBox的属性窗口。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.