组合框问题 [英] Problem On Combo Box

查看:122
本文介绍了组合框问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



其中为组合框分配的自动完成功能,
将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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆