组合框问题 [英] Problem On Combo Box
问题描述
其中为组合框分配的自动完成功能,
将AutoCompleteMode设置为建议添加,将AutoCompleteSource设置为列出项目.
我已经在组合框的keypress事件中编写了一个代码块,例如当按下Enter键时,请执行一些操作.
按键事件不会触发.输入回车键.
如果未分配自动完成功能,则会触发按键事件.
基本的麻烦是我丢失了我的代码的输入键序列.
即,使用Enter键移动到下一个字段,而不是使用Tab键移动到下一个字段.
给出纠正此错误的想法
Hi,
A Combobox assigned autocomplete feature in it,
set AutoCompleteMode to suggestappend, and AutoCompleteSource to List items.
i have written a code block in the keypress event of the combobox,like when enter key is pressed, do some action.
the keypress event doesn''t fires. for enter key.
Without autocomplete feature assigned, the keypress event fires.
the basic trouble i am losing my enter key sequence for my code.
i.e., instead of tab key to move to next field, using enter key to move to next field.
give idea to rectify this error
推荐答案
使用KeyDown事件
Use the KeyDown event
Private Sub ComboBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ComboBox1.KeyDown
If e.KeyCode = Keys.Enter Then
' if you want to simulate a tab,
SendKeys.Send(vbTab)
End If
End Sub
这篇关于组合框问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!