组合框下拉列表和按键
我有一个下拉列表,其中包含所有 TimeZone.Displayname
所有这些显示名称均显示为:
(GMT +09:00) 首尔,(GMT -06:00) 中部时间(美国和美国)加拿大)等。
有没有办法让按键事件搜索“)”之后的第一个字母?现在它只识别组合框字符串的第一个字符,即“(”
编辑
更改标题,因为时区实际上与问题无关。
I have a dropdownlist that holds all of the TimeZone.Displayname
All of these display names come out as:
(GMT +09:00) Seoul, (GMT -06:00) Central Time (US & Canada), etc.
Is there a way to have a keypress event that would search through the first letter after the ")"? Right now it only recognizes the first character of the combobox string which is "("
EDIT
Changed title because timezones don't really have to do with the issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须自己提供 keydown 搜索功能。例如,覆盖
KeyPress
,每当按下某个键时,循环遍历列表并显示所需的列表项。或者您可以使用ComboBox.FindString
查找字符串的方法,如下所示:You will have to provide the keydown-search functionality yourself. For instance, override the
KeyPress
, and whenever a key is pressed loop through the list and show the desired list item. Or you can useComboBox.FindString
method to find the string, something like following:我会建立你的列表并将字符串顺序交换为
......
有两列的列表,因此您可以获得原始列值和用于显示的修订后的值。您的组合框可以有一个“显示”值和“值”...
I would build your list and swap the string order to
instead...
have the list of two columns so you have the original column value and the revised for display. Your combobox can have a "display" value and the "Value"...