在组合框中用键盘上的↑↓键选取\用键盘上下键实现组合框数据的选择-54.℡80後2oO
Access软件网QQ交流学习群(群号码198465573),欢迎您的加入!
首页 >技术文章> Access数据库-窗体/数据页


在组合框中用键盘上的↑↓键选取\用键盘上下键实现组合框数据的选择

发表时间:2008/9/1 10:12:12 评论(2) 浏览(8467)  评论 | 加入收藏 | 复制
   
摘 要:在组合框中不用鼠标点击,不用xxx.Dropdown命令,就可以用键盘上的↑↓键选取内容.
正 文:

在组合框的键按下事件中加入:

Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = 38 Then

    Screen.ActiveControl.ListIndex = (Screen.ActiveControl.ListIndex - 1) Mod Screen.ActiveControl.ListCount
    KeyCode = 0

End If

If KeyCode = 40 Then

    Screen.ActiveControl.ListIndex = (Screen.ActiveControl.ListIndex + 1) Mod Screen.ActiveControl.ListCount
    KeyCode = 0

End If

Me.Combo1.SelStart = Len(Combo1)

End Sub

 也可以在鼠标双击事件中加入下面一句以便录入:

Screen.ActiveControl.ListIndex = (Screen.ActiveControl.ListIndex + 1) Mod Screen.ActiveControl.ListCount

试试看,,,这种效果是不是觉得用起来更爽一点


Access软件网交流QQ群(群号:198465573)
 
 相关文章
access键盘快捷键大全  【UMVsoft整理  2008/11/18】
(转)在窗体中调用WINDOWS的屏幕键盘示例  【jia  2011/11/18】
常见问答
技术分类
相关资源
文章搜索
关于作者

54.℡80後2oO

文章分类

文章存档

友情链接